Skip to content

promote-baseline: a squash-merged PR promotes on the gated head's tree (campaign template) - #143

Merged
luisleo526 merged 1 commit into
mainfrom
cg/promote-tree
Sep 26, 2026
Merged

luisleo526 merged 1 commit into
mainfrom
cg/promote-tree

Conversation

@luisleo526

Copy link
Copy Markdown
Contributor

What

.github/workflows/promote-baseline.yml now takes the campaign's squash-aware template and is byte-identical to campaign/ci/promote-baseline.yml in pineforge-workflow (merged there as #70). Every PR ships as a squash merge, so the old exact-head workflow could never promote a codegen merge.

  • It runs on pull_request_target (main's copy), and workflow_dispatch gains a head_sha input.
  • It checks that the merge commit is on main and carries the gated head's tree. It then calls lab promote --repo codegen --merge-commit <merge_commit_sha> --head-sha <head> --merge-tree <tree>.
  • Codegen's green check: the required gate check-run succeeded (paginated), and no check-run failed.
  • GH_TOKEN is set on the promote step: lab promote reads both trees from GitHub, so the caller supplies no trusted tree.

The file takes effect after this merges, because pull_request_target runs main's copy.

Checks

  • actionlint 1.7.12 with shellcheck: clean. The file parses as YAML.
  • The jq filters were exercised on a real merged PR's check-runs at page sizes 100, 3 and 2.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LifAW9e5J6gFx7gatuxETE

…tes on the gated tree

The installed copy triggered on `pull_request`, whose `@refs/pull/<n>/merge`
identity the promotion service account's workload-identity condition no
longer admits (it pins promote-baseline.yml@refs/heads/main), required the PR
head to be an ancestor of main (a squash merge's head never is), passed the
head as the merge commit with no --merge-tree, and minted its App token with
every permission of the installation.

This is pineforge-workflow's campaign/ci/promote-baseline.yml, byte for byte,
as pineforge-engine runs it:

- `pull_request_target: [closed]`: main's own copy, which checks out and runs
  no PR code (the PR head's objects are fetched only to read its tree);
- it promotes only when merge_commit_sha is on main and carries the PR head's
  tree, then calls `lab promote --repo codegen --merge-commit <merge_commit_sha>
  --head-sha <PR head> --merge-tree <tree>`, which re-reads both trees from
  GitHub with the job's read-only GH_TOKEN before appending the baseline;
- the green check stays codegen's own: the required `gate` check-run has
  succeeded on the PR head and no check-run failed (paginated);
- `workflow_dispatch` gains the `head_sha` input for a manual re-fire;
- the org App token is scoped to pineforge-workflow, permission-contents: read.

`pull_request_target` runs main's copy, so this takes effect for merges after
this PR itself has merged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@luisleo526
luisleo526 merged commit b0231c3 into main Sep 26, 2026
9 checks passed
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