Skip to content

Commit

Permalink
fix(workflow): add PAT token for improved authentication
Browse files Browse the repository at this point in the history
- Added `token: ${{ secrets.PAT_TOKEN }}` to `actions/checkout` steps
  to enhance authentication during checkout.
- Added step to set up remote URL using PAT for secure push operations.
- Removed redundant `env` declarations for `GITHUB_TOKEN` in steps
  where it's not necessary anymore.
  • Loading branch information
infuzu-yidisprei committed Sep 11, 2024
1 parent dd62544 commit ddc6712
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/tag-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}

- name: Set up Git
run: |
Expand Down Expand Up @@ -45,18 +47,19 @@ jobs:
fi
echo "new_version=$new_version" >> $GITHUB_ENV
- name: Set Up Remote URL with PAT
run: |
git remote set-url origin https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository }}.git
git remote -v # Print the current remote URL configuration
- name: Create and Push Tag
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
git tag "v$new_version"
echo "Pushing tag v$new_version"
git push https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository }}.git "v$new_version"
- name: Update VERSION file (if version was incremented)
if: env.use_tag == 'false'
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
echo $new_version > VERSION
git add VERSION
Expand All @@ -70,6 +73,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}

- name: Set up Go
uses: actions/setup-go@v5
Expand Down

0 comments on commit ddc6712

Please sign in to comment.