Skip to content

Commit e581ec3

Browse files
authored
chore: avoid persisting checkout credentials (#151)
## Changes - Disable credential persistence on the release checkout. - Authenticate tag pushes explicitly with the short-lived GitHub App token. - Remove the unused token-bearing remote. ## Tests - actionlint - Security scan of the changed workflow
1 parent e3d9e7e commit e581ec3

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

.github/workflows/release.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,19 @@ jobs:
3131
manifest-file: .release-please-manifest.json
3232
include-component-in-tag: false
3333

34-
# persist-credentials must stay enabled: the tag step below pushes to `origin`
35-
# using the credentials this checkout writes into .git/config.
3634
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
3735
if: ${{ steps.release.outputs.release_created }}
36+
with:
37+
token: ${{ steps.generate-token.outputs.token }}
38+
persist-credentials: false
3839
- name: Tag Major and Minor versions
3940
if: ${{ steps.release.outputs.release_created }}
41+
env:
42+
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
4043
run: |
4144
git config user.name github-actions[bot]
4245
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
43-
git remote add gh-token "https://${{ steps.generate-token.outputs.token }}@github.com/Lendable/sloth.git"
46+
gh auth setup-git
4447
git tag -d v${{ steps.release.outputs.major }} || true
4548
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
4649
git push origin :v${{ steps.release.outputs.major }} || true

0 commit comments

Comments
 (0)