Skip to content

Commit 4532bc6

Browse files
baywetCopilot
andcommitted
ci: align promote workflow token permissions (#3067)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ce1ac2d commit 4532bc6

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

.github/workflows/promote-shipped-apis.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ jobs:
2424
with:
2525
client-id: ${{ vars.RELEASE_PLEASE_TOKEN_PROVIDER_APP_ID }}
2626
private-key: ${{ secrets.RELEASE_PLEASE_TOKEN_PROVIDER_PEM }}
27+
permission-contents: write
28+
permission-pull-requests: write
29+
30+
- name: Get GitHub App user ID
31+
id: get-user-id
32+
shell: bash
33+
env:
34+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
35+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
2736

2837
- name: Checkout code
2938
uses: actions/checkout@v6
@@ -36,9 +45,9 @@ jobs:
3645
env:
3746
GH_TOKEN: ${{ steps.app-token.outputs.token }}
3847
run: |
39-
git config --global user.name "github-actions[bot]"
40-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
41-
git config --global url."https://$($env:GH_TOKEN)@github.com/".insteadOf "https://github.com/"
48+
git config --global user.name "${{ steps.app-token.outputs.app-slug }}[bot]"
49+
git config --global user.email "${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com"
50+
git config --global url."https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/".insteadOf "https://github.com/"
4251
4352
- name: Check for existing PR
4453
id: check_pr

0 commit comments

Comments
 (0)