Skip to content

Migrate GitHub Actions secrets with bk - #1004

Merged
lox merged 2 commits into
mainfrom
feat/github-actions-secret-migration
Sep 28, 2026
Merged

lox merged 2 commits into
mainfrom
feat/github-actions-secret-migration

Conversation

@lox

@lox lox commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Description

Move the GitHub Actions repository-secret migration shipped in buildkite-gha v0.90.0 into bk, so Buildkite authentication, pipeline discovery, destination preflight, and grant creation use the CLI's native authenticated API client.

The new command is:

bk secret migrate github-actions prepare --match 'DEPLOY_*' --output .github/workflows/migrate-buildkite-secrets.yml
bk secret migrate github-actions run --workflow .github/workflows/migrate-buildkite-secrets.yml

Changes

  • Add guided and --no-input prepare flows with static secret selection, create-only destination checks, restricted policy validation, and deterministic workflow generation.
  • Verify the local and exact default-branch workflow revision before creating a short-lived, one-use migration grant and dispatching through gh.
  • Keep generated workflows byte-compatible with buildkite-gha v0.90.0 so either CLI can run an already reviewed workflow.
  • Clarify that dispatch is not completion, print the exact Actions run URL when available (otherwise the workflow URL), and include grant recovery guidance.
  • Document the security model and a precise buildkite-gha migrate-secrets wrapper/deprecation follow-up. --watch is intentionally omitted because not every supported dispatch path returns an immutable run ID.

Testing

  • Tests have run locally (mise run test)
  • Code is formatted (mise run format)
  • Lint passes (mise run lint)
  • Vulnerability check passes (mise run vulncheck)

Disclosures / Credits

Amp implemented the command, tests, documentation, and compatibility checks based on buildkite-gha PR #247 / v0.90.0, then ran local auto-review and validation.

@lox
lox requested review from a team as code owners September 27, 2026 23:10

@buildsworth-bk-app buildsworth-bk-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found no actionable issues in the prepare and dispatch paths. Because this introduces secret migration and grant creation, the credential boundary needs a human review before approval.

Want to dig deeper?

Paste this into your agent to explore the findings from this review's Buildkite build:

Download the buildsworth logs from build 32725, then answer my questions about the findings.

Install the reading-buildsworth-logs skill to run this.

About buildsworth

Model: gpt-6-sol with xhigh thinking.

How to request a review: Comment @buildsworth-bk review on the PR, or request buildsworth-bk as a reviewer.

Risk labels (how buildsworth classifies risk) — buildsworth classifies risk itself from the diff. Unless repository policy already allows L2 approval, grant it by mentioning @buildsworth-bk (see approval ceiling and L2 approval grant):

  • L1 — Low risk (dep bumps, docs/copy, lockfiles, small presentational fixes). buildsworth may approve by default.
  • L2 — Standard risk (new UI, additive API fields, refactors). Approved only when repository policy or a verified grant allows it; otherwise comment-only.
  • L3 — High risk (auth, migrations, payments, secrets, perf-critical pipeline paths). Human approval required unless repository policy explicitly allows L3 approval; per-PR grants cannot allow it.

@mcncl mcncl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love the way this has been implemented, but can appreciate that it will likely be used by LLMs for the most part and the command structure suits that usage (clear options etc).

If we do consider additional sources further down the line we might want to implement some interfaces so that we can have a common pattern, but that's not in scope right now.

@lox

lox commented Sep 28, 2026

Copy link
Copy Markdown
Contributor Author

🤖 @mcncl I revisited the structure after your review. The command/auth layer now delegates to a concrete GitHub Actions migration orchestrator, with narrow Buildkite and GitHub capability interfaces at the external boundaries; policy validation and deterministic workflow generation are separated by responsibility. I deliberately avoided a generic provider interface until a second source proves a genuinely shared lifecycle. Behavior and generated workflow bytes are unchanged, and the full local checks plus an Oracle architecture/security review are clean. Would you give the new head another look and let me know whether this resolves your concern?

@buildsworth-bk-app buildsworth-bk-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No actionable issues found in this revision. Grant creation and the secret-transfer workflow put this above the L2 approval ceiling, so this is comment-only.

Want to dig deeper?

Paste this into your agent to explore the findings from this review's Buildkite build:

Download the buildsworth logs from build 32871, then answer my questions about the findings.

Install the reading-buildsworth-logs skill to run this.

@mcncl

mcncl commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Looks good to me. Followed up with Amp on future support of external providers.

Status: happy

@lox
lox merged commit 6954687 into main Sep 28, 2026
2 checks passed
@lox
lox deleted the feat/github-actions-secret-migration branch September 28, 2026 05:10
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.

2 participants