@@ -17,27 +17,45 @@ jobs:
1717 runs-on : ubuntu-2404-2core
1818 if : ${{ !startsWith(github.event.head_commit.message, 'release:') && !github.event.inputs.version }}
1919 steps :
20+ # GITHUB_TOKEN cannot trigger workflows on PRs it creates, so the release PR
21+ # would not run CI — generate a GitHub App installation token instead.
22+ - name : Generate token
23+ id : app-token
24+ uses : actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
25+ with :
26+ client-id : ${{ secrets.REPO_TRIVY_WRITE_GH_APP_CLIENT_ID }}
27+ private-key : ${{ secrets.REPO_TRIVY_WRITE_GH_APP_PRIVATE_KEY }}
28+
2029 - name : Release Please
2130 id : release
2231 uses : googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0
2332 with :
24- token : ${{ secrets.TRIVY_REPO_TOKEN }}
33+ token : ${{ steps.app-token.outputs.token }}
2534 target-branch : ${{ github.ref_name }}
2635
2736 manual-release-please :
2837 runs-on : ubuntu-2404-2core
2938 if : ${{ github.event.inputs.version }}
3039 steps :
40+ # GITHUB_TOKEN cannot trigger workflows on PRs it creates, so the release PR
41+ # would not run CI — generate a GitHub App installation token instead.
42+ - name : Generate token
43+ id : app-token
44+ uses : actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
45+ with :
46+ client-id : ${{ secrets.REPO_TRIVY_WRITE_GH_APP_CLIENT_ID }}
47+ private-key : ${{ secrets.REPO_TRIVY_WRITE_GH_APP_PRIVATE_KEY }}
48+
3149 - name : Install Release Please CLI
3250 run : npm install release-please -g
3351
3452 - name : Release Please
3553 env :
3654 RELEASE_VERSION : ${{ github.event.inputs.version }}
37- TRIVY_REPO_TOKEN : ${{ secrets.TRIVY_REPO_TOKEN }}
55+ APP_TOKEN : ${{ steps.app-token.outputs.token }}
3856 run : |
3957 release-please release-pr --repo-url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
40- --token="$TRIVY_REPO_TOKEN " \
58+ --token="$APP_TOKEN " \
4159 --release-as="$RELEASE_VERSION" \
4260 --target-branch="$GITHUB_REF_NAME"
4361
@@ -57,13 +75,23 @@ jobs:
5775 echo "pr_number=$( echo "$COMMIT_MESSAGE" | sed 's/.*(\#\([0-9]\+\)).*$/\1/' )" >> $GITHUB_OUTPUT
5876 echo "release_branch=release/v$( echo "$COMMIT_MESSAGE" | sed 's/^release: v\([0-9]\+\.[0-9]\+\).*$/\1/' )" >> $GITHUB_OUTPUT
5977
78+ # GITHUB_TOKEN cannot trigger the release workflow on the created tag —
79+ # generate a GitHub App installation token instead.
80+ - name : Generate token
81+ id : app-token
82+ if : ${{ steps.extract_info.outputs.version }}
83+ uses : actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
84+ with :
85+ client-id : ${{ secrets.REPO_TRIVY_WRITE_GH_APP_CLIENT_ID }}
86+ private-key : ${{ secrets.REPO_TRIVY_WRITE_GH_APP_PRIVATE_KEY }}
87+
6088 - name : Tag release
6189 if : ${{ steps.extract_info.outputs.version }}
6290 uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
6391 env :
6492 VERSION : ${{ steps.extract_info.outputs.version }}
6593 with :
66- github-token : ${{ secrets.TRIVY_REPO_TOKEN }} # To trigger another workflow
94+ github-token : ${{ steps.app-token.outputs.token }} # To trigger another workflow
6795 script : |
6896 await github.rest.git.createRef({
6997 owner: context.repo.owner,
0 commit comments