From 086d03d6e71e3327f05b9836a9746913bd7b24d8 Mon Sep 17 00:00:00 2001 From: Tawanda Kembo Date: Sat, 27 Jul 2024 16:43:47 +0200 Subject: [PATCH 1/2] chore: fix PAT_TOKEN usage in GitHub Actions workflow --- bump_version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bump_version.sh b/bump_version.sh index f640f3f..1885f98 100755 --- a/bump_version.sh +++ b/bump_version.sh @@ -54,7 +54,7 @@ GIT_ASKPASS=$(mktemp) echo "echo \$PAT_TOKEN" > $GIT_ASKPASS chmod +x $GIT_ASKPASS -GIT_HTTP_USER_AGENT="git/2.29.0" GIT_ASKPASS=$GIT_ASKPASS git push origin "v$NEW_VERSION" +GIT_ASKPASS=$GIT_ASKPASS git push origin "v$NEW_VERSION" # Clean up rm $GIT_ASKPASS \ No newline at end of file From 1e3a1fb8e462fb1073f4951d8042a07a2efacdcb Mon Sep 17 00:00:00 2001 From: Tawanda Kembo Date: Sat, 27 Jul 2024 16:57:50 +0200 Subject: [PATCH 2/2] chore: fix PAT_TOKEN usage in GitHub Actions workflow --- .github/workflows/tag-and-release.yml | 4 ++-- bump_version.sh | 15 +++++---------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml index 84d1188..134fd4a 100644 --- a/.github/workflows/tag-and-release.yml +++ b/.github/workflows/tag-and-release.yml @@ -27,7 +27,7 @@ jobs: - name: Bump version and push tag env: DEFAULT_BUMP: minor - PAT_TOKEN: ${{ secrets.PAT_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: ./bump_version.sh - name: Create Release @@ -41,4 +41,4 @@ jobs: draft: false prerelease: false env: - GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/bump_version.sh b/bump_version.sh index 1885f98..6c0a426 100755 --- a/bump_version.sh +++ b/bump_version.sh @@ -35,25 +35,20 @@ esac NEW_VERSION="$MAJOR.$MINOR.$PATCH" -# Configure git to use the PAT +# Configure git to use the GITHUB_TOKEN git config --global user.name "github-actions" git config --global user.email "github-actions@github.com" -# Debug information -echo "Setting remote URL with PAT_TOKEN" -echo "PAT_TOKEN: ${#PAT_TOKEN}" - -# Set the remote URL with the PAT -git remote set-url origin "https://${PAT_TOKEN}@github.com/tawanda-kembo/code-collator.git" +# Set the remote URL with the GITHUB_TOKEN +git remote set-url origin "https://${GITHUB_TOKEN}@github.com/tawanda-kembo/code-collator.git" # Create a new tag git tag "v$NEW_VERSION" -# Push the tag using the PAT +# Push the tag using the GITHUB_TOKEN GIT_ASKPASS=$(mktemp) -echo "echo \$PAT_TOKEN" > $GIT_ASKPASS +echo "echo \$GITHUB_TOKEN" > $GIT_ASKPASS chmod +x $GIT_ASKPASS - GIT_ASKPASS=$GIT_ASKPASS git push origin "v$NEW_VERSION" # Clean up