Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a5d3471

Browse files
tstellarc-rhodes
authored andcommitted
workflows/release-task: Use less privileged token for uploading release notes (llvm#180299) (llvm#180650)
We were using one token for both pushing to the llvmbot fork and for creating a pull request against the www-releases repository, since the fork and the repository have different owners, we were using a classic access token which has very coarse-grained permissions. By using two separate tokens, we limit the permissions to just what we need to do the task. This is a re-commit of b6ee085 minus the environment changes which were causing the workflow to fail. (cherry picked from commit 48dffbc)
1 parent 2566c81 commit a5d3471

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

.github/workflows/release-documentation.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ on:
2626
required: false
2727
type: boolean
2828
secrets:
29+
LLVMBOT_WWW_RELEASES_PUSH:
30+
description: "Secret used to push changes to llvmbot www-releases fork."
31+
required: false
2932
WWW_RELEASES_TOKEN:
3033
description: "Secret used to create a PR with the documentation changes."
3134
required: false
@@ -81,6 +84,7 @@ jobs:
8184
- name: Upload Release Notes
8285
if: env.upload
8386
env:
87+
PUSH_TOKEN: ${{ secrets.LLVMBOT_WWW_RELEASES_PUSH }}
8488
GH_TOKEN: ${{ secrets.WWW_RELEASES_TOKEN }}
8589
run: |
8690
mkdir -p www-releases/${{ inputs.release-version }}
@@ -91,5 +95,5 @@ jobs:
9195
git config user.email "[email protected]"
9296
git config user.name "llvmbot"
9397
git commit -a -m "Add ${{ inputs.release-version }} documentation"
94-
git push --force "https://$GH_TOKEN@github.com/llvmbot/www-releases.git" HEAD:refs/heads/${{ inputs.release-version }}
98+
git push --force "https://$PUSH_TOKEN@github.com/llvmbot/www-releases.git" HEAD:refs/heads/${{ inputs.release-version }}
9599
gh pr create -f -B main -H llvmbot:${{ inputs.release-version }}

.github/workflows/release-tasks.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
upload: true
5757
# Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use.
5858
secrets:
59+
LLVMBOT_WWW_RELEASES_PUSH: ${{ secrets.LLVMBOT_WWW_RELEASES_PUSH }}
5960
WWW_RELEASES_TOKEN: ${{ secrets.WWW_RELEASES_TOKEN }}
6061

6162
release-doxygen:

0 commit comments

Comments
 (0)