fix: write finalize state through GitHub API to satisfy protected trunk - #94
Merged
Merged
Conversation
The generated finalize jobs persisted manifest state with git push to the trunk branch. With branch protection requiring a status check, that push is rejected, and the bot commits are unsigned. On real GitHub the orchestrate, release, and promote finalize paths now write the manifest through the Contents REST API, which produces a verified, signed commit and, with a bypass-capable token, updates a protected trunk. The act/gitea e2e path keeps the existing git push. A new optional state_token config (default GITHUB_TOKEN) supplies the API token. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
joshua-temple
force-pushed
the
fix/finalize-state-commit
branch
from
June 10, 2026 13:56
d04d8f3 to
37d3252
Compare
This was referenced Jun 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the Orchestrate "Finalize" job, which fails now that
mainis protected: it pushes thechore: update state [skip ci]commit withgit push origin main, and branch protection rejects the direct push (GH006: Required status check "PR Gate" is expected). The same bot commits were also unsigned.On real GitHub the state write now goes through the Contents REST API (
gh api -X PUT repos/{repo}/contents/<manifest>). API commits are signed by GitHub (Verified) and, with a bypass-capable token, update the protected trunk without satisfying the PR gate. The act/gitea e2e environment keeps the existinggit pushpath, detected viaGITHUB_SERVER_URL, so the harness is unchanged.state_write.go) and the CLI'sFinalizer.CommitAndPush, which branch on real-GitHub vs gitea.state_tokenmanifest field (default${{ secrets.GITHUB_TOKEN }}), emitted asGH_TOKEN, so the token used for the API write is configurable. Point it at a bypass-capable App or PAT secret to activate the protected-trunk write. Existing manifests are unaffected.Verification:
go build ./...clean,go test ./internal/...green (1008),go vetandgolangci-lintclean, generated workflows contain zero em dashes, and the multistep e2e (TestMultiStepScenarios) passes under act, confirming the gitea path is preserved.Note: until the
state_tokenis pointed at a bypass-capable token, the defaultGITHUB_TOKENcannot update the protected branch, so this PR puts the mechanism in place but the trunk write activates once that secret is configured.