Skip to content

feat: support repository and organization agent secrets - #3706

Open
michikrug wants to merge 4 commits into
integrations:mainfrom
Staffbase:3463-agent-secrets
Open

michikrug wants to merge 4 commits into
integrations:mainfrom
Staffbase:3463-agent-secrets

Conversation

@michikrug

Copy link
Copy Markdown

Refs #3463. Implements Agent Secrets; Agent Variables remain for a follow-up.

Before the change?

The provider cannot manage GitHub Agent Secrets, which use APIs separate from Actions secrets.

After the change?

Adds repository and organization secret resources, individual and complete-set repository access resources, and four public-key/secret-metadata data sources.

Supports plaintext encryption, pre-encrypted values with key IDs, imports, and repository rename handling. Uses the existing go-github dependency.

Organization updates preserve the live repository allowlist. Timestamp-based drift detection accounts for access changes; simultaneous access/value changes and concurrent-update limitations are documented.

How to review?

Focus on schemas, organization update semantics, and drift detection.

476 local tests and build/lint/docs checks passed. Live GitHub.com testing covered creation, rotation, imports, access management, visibility changes, no-op plans, and cleanup. Full live acceptance testing remains outstanding, including pre-encrypted inputs and rename/replacement.

Pull request checklist

  • No schema migrations required
  • Tests added
  • Docs/examples reviewed and added

Does this introduce a breaking change?

  • Yes
  • No

Substantially AI-assisted; verification above was completed.

Co-authored-by: opencode <opencode@noreply.opencode.ai>
Co-authored-by: GitHub Copilot <copilot@noreply.github.com>

intent(agent-secrets): manage GitHub Agent Secrets with Terraform following the Actions Secrets pattern for upstream issue integrations#3463.
decision(agent-secrets): reuse the existing Agents SDK and encryption helper; manage organization repository access separately from secret values.
constraint(verification): local checks pass; live acceptance testing is still required to confirm GitHub preserves selected repository access during rotation.

Refs integrations#3463
Co-authored-by: opencode <opencode@noreply.opencode.ai>
Co-authored-by: GitHub Copilot <copilot@noreply.github.com>

learned(agent-secrets): GitHub clears selected repositories when a secret PUT omits the list, and access edits also advance the secret timestamp.
decision(agent-secrets): resubmit live repository access during rotation and track observed access to avoid false value drift.
constraint(agent-secrets): simultaneous access and value changes cannot be distinguished; document that limitation and concurrent-update risks.

Verified with 454 local tests and live creation, rotation, imports, access management, no-op plans, and cleanup in Staffbase/infrastructure.

Refs integrations#3463
Co-authored-by: opencode <opencode@noreply.opencode.ai>
Co-authored-by: GitHub Copilot <copilot@noreply.github.com>

decision(agent-secrets): share create/update callbacks where creation adds no separate behavior, matching existing association resources.
decision(agent-secret-tests): remove low-value schema-validation and access-call mocks while retaining lifecycle and regression coverage.

Verified: 446 non-acceptance tests passed; strict lint reported 0 issues.

Refs integrations#3463
Co-authored-by: opencode <opencode@noreply.opencode.ai>
Co-authored-by: GitHub Copilot <copilot@noreply.github.com>

learned(agent-secrets): listing access returns an empty list for non-selected secrets, but removing access returns 409.
decision(agent-secrets): confirm non-selected visibility before accepting deletion conflicts; preserve unrelated conflicts and lookup failures.
decision(agent-secret-tests): colocate tests with resources and data sources, strengthen metadata assertions, and retain a focused empty-array deletion regression.

Expand schema fields to match surrounding provider conventions.
Verified: 458 local tests, build and lint, docs generation and validation, and live visibility-change cleanup.

Refs integrations#3463
@github-actions

Copy link
Copy Markdown

👋 Hi, and thank you for this contribution!

This repo is maintained by GitHub and community members on a best-effort basis. We'll get to this as soon as we can.

You can help us prioritize by joining the discussion on open issues and PRs, sharing details on the changes you need, and reviewing other contributions.


🤖 This is an automated message.

@michikrug
michikrug marked this pull request as ready for review October 29, 2026 16:09

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant