File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3838 uses : actions/checkout@v6
3939 with :
4040 fetch-depth : 0
41+ persist-credentials : false
4142
4243 - name : Fetch production main
4344 env :
@@ -70,13 +71,21 @@ jobs:
7071
7172 - name : Sync production to staging (fast-forward)
7273 if : steps.diff.outputs.behind == 'true'
74+ env :
75+ PRODUCTION_REPO_TOKEN : ${{ secrets.PRODUCTION_REPO_TOKEN }}
7376 run : |
7477 # Refuse unless staging is an ancestor of production: otherwise the
7578 # trunks have forked and a fast-forward would be unsafe.
7679 if ! git merge-base --is-ancestor origin/main production/main; then
7780 echo "::error title=Back-sync blocked::staging main is not an ancestor of production/main."
7881 exit 1
7982 fi
83+ if [ -z "${PRODUCTION_REPO_TOKEN:-}" ]; then
84+ echo "::error title=Back-sync blocked::PRODUCTION_REPO_TOKEN is required to update staging main."
85+ exit 1
86+ fi
87+ git remote set-url origin \
88+ "https://x-access-token:${PRODUCTION_REPO_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
8089 git push origin production/main:refs/heads/main
8190 echo "Fast-forwarded staging/main to production/main."
8291
You can’t perform that action at this time.
0 commit comments