Skip to content

Commit 714607b

Browse files
committed
ci: authenticate the release push via gh instead of a token URL
Per review, use `gh auth setup-git` so the push uses the app token through gh's credential helper rather than embedding it in the push URL. The token never lands in the git config or the command log, and with the credential helper doing the work the run block can keep `set -x` on for debugging. Note: AI-assisted (Claude Code). Verified `gh auth git-credential` returns the GH_TOKEN from the environment (username x-access-token), so the helper authenticates the push in the runner where GH_TOKEN is set.
1 parent b43fcb2 commit 714607b

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

.github/workflows/releasepr.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ jobs:
4545
APP_VERSION: ${{ steps.package-info.outputs.version }}
4646
GH_TOKEN: ${{ secrets.JLAB_APP_TOKEN }}
4747
run: |
48-
# No -x: the push URL carries the token, so keep it out of the log
49-
# (GitHub also masks the secret, this is belt and suspenders).
50-
set -eu
48+
set -eux
5149
# git checkout -b fails if the branch already exists, which keeps a
5250
# re-run from opening a duplicate release PR.
5351
BRANCH_NAME="release-v${APP_VERSION}"
@@ -58,11 +56,11 @@ jobs:
5856
date +%s > auto-release.log
5957
git add auto-release.log
6058
git commit -m "Update auto-release logs"
61-
# Checkout persisted no credentials, so authenticate this one push with
62-
# the app token instead of keeping it in the git config all job long.
63-
git push \
64-
"https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" \
65-
"HEAD:refs/heads/${BRANCH_NAME}"
59+
# Checkout ran with persist-credentials: false. Wire the app token in
60+
# through gh's credential helper just for this push, so it never lands
61+
# in the git config or the command log; git push then uses GH_TOKEN.
62+
gh auth setup-git
63+
git push origin "HEAD:refs/heads/${BRANCH_NAME}"
6664
6765
gh pr create \
6866
--head "${BRANCH_NAME}" \

0 commit comments

Comments
 (0)