Skip to content

Commit 3d2c3f0

Browse files
Use bot token to clone repository (#1554)
- Use the bot token to clone the repository. - Remove GITHUB_TOKEN permissions.
1 parent 3f1b435 commit 3d2c3f0

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

.github/workflows/on-push-do-docs.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,27 @@ on:
66
paths: [ "src/Snippets/**" ]
77
workflow_dispatch:
88

9-
permissions:
10-
contents: read
9+
permissions: {}
1110

1211
jobs:
1312
update-docs:
1413
name: update-docs
1514
runs-on: ubuntu-latest
1615

1716
steps:
17+
18+
- name: Generate GitHub application token
19+
id: generate-application-token
20+
uses: peter-murray/workflow-application-token-action@8e1ba3bf1619726336414f1014e37f17fbadf1db # v2.1.0
21+
with:
22+
application_id: ${{ secrets.POLLY_UPDATER_BOT_APP_ID }}
23+
application_private_key: ${{ secrets.POLLY_UPDATER_BOT_KEY }}
24+
permissions: "contents:write, pull_requests:write"
25+
1826
- name: Checkout code
1927
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
28+
with:
29+
token: ${{ steps.generate-application-token.outputs.token }}
2030

2131
- name: Setup .NET SDK
2232
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
@@ -64,15 +74,6 @@ jobs:
6474
git push -u origin $BranchName
6575
"updated-docs=true" >> $env:GITHUB_OUTPUT
6676

67-
- name: Generate GitHub application token
68-
if: steps.update-docs.outputs.updated-docs == 'true'
69-
id: generate-application-token
70-
uses: peter-murray/workflow-application-token-action@8e1ba3bf1619726336414f1014e37f17fbadf1db # v2.1.0
71-
with:
72-
application_id: ${{ secrets.POLLY_UPDATER_BOT_APP_ID }}
73-
application_private_key: ${{ secrets.POLLY_UPDATER_BOT_KEY }}
74-
permissions: "contents:write, pull_requests:write"
75-
7677
- name: Create pull request
7778
if: steps.update-docs.outputs.updated-docs == 'true'
7879
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1

0 commit comments

Comments
 (0)