Skip to content

Commit 45d2046

Browse files
ci(stlc): back-sync pushes staging main as the automation identity
Staging main is getting a pull-request rule whose only bypass is the automation's repository role. The back-sync job pushed with GITHUB_TOKEN, which cannot be a bypass actor (GitHub Actions is not an org-owned app), so push with PRODUCTION_REPO_TOKEN (the service account) instead. Token pushes also trigger seal-dispatch, so the config repo re-seals immediately after a back-sync rather than at the next scheduled run. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017oDfpQ4KpmpTzYm2fZ9eaL
1 parent 5bf88f0 commit 45d2046

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎.github/workflows/stlc-sync.yml‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,26 @@ jobs:
7676
7777
- name: Sync production to staging (fast-forward)
7878
if: steps.diff.outputs.behind == 'true'
79+
env:
80+
PUSH_TOKEN: ${{ secrets.PRODUCTION_REPO_TOKEN }}
7981
run: |
8082
# Refuse unless staging is an ancestor of production: otherwise the
8183
# trunks have forked and a fast-forward would be unsafe.
8284
if ! git merge-base --is-ancestor origin/main production/main; then
8385
echo "::error title=Back-sync blocked::staging main is not an ancestor of production/main."
8486
exit 1
8587
fi
86-
git push origin production/main:refs/heads/main
88+
# Push as the automation identity (PRODUCTION_REPO_TOKEN), not GITHUB_TOKEN:
89+
# staging main requires a pull request for humans and only the automation's
90+
# repository role bypasses that rule. A token push (unlike GITHUB_TOKEN) also
91+
# triggers seal-dispatch, so the config repo re-seals right away instead of
92+
# at the next scheduled sync. Blank the persisted GITHUB_TOKEN header first.
93+
if [ -n "${PUSH_TOKEN:-}" ]; then
94+
git -c "http.https://github.com/.extraheader=" push \
95+
"https://x-access-token:${PUSH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" production/main:refs/heads/main
96+
else
97+
git push origin production/main:refs/heads/main
98+
fi
8799
echo "Fast-forwarded staging/main to production/main."
88100
89101
- name: Alert on failure

0 commit comments

Comments
 (0)