Skip to content

Commit 9573dcc

Browse files
authored
Remove PAT in release workflow (#4864)
1 parent 4b82f80 commit 9573dcc

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
with:
6464
version: ${{ needs.release.outputs.version }}
6565
secrets:
66-
PERSONAL_ACCESS_TOKEN: ${{ secrets.XIANG17_TOKEN }}
66+
AI_JAVA_HELPER_APP_PRIVATE_KEY: ${{ secrets.AI_JAVA_HELPER_APP_PRIVATE_KEY }}
6767

6868
create-version-bump-pull-request:
6969
permissions: write-all

‎.github/workflows/reusable-create-docs-pull-request.yml‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
type: string
88
required: true
99
secrets:
10-
PERSONAL_ACCESS_TOKEN:
10+
AI_JAVA_HELPER_APP_PRIVATE_KEY:
1111
required: true
1212
# to help with partial release build failures
1313
workflow_dispatch:
@@ -20,23 +20,31 @@ jobs:
2020
create-docs-pull-request:
2121
runs-on: ubuntu-latest
2222
steps:
23+
- name: Generate GitHub App token
24+
id: app-token
25+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
26+
with:
27+
client-id: ${{ vars.AI_JAVA_HELPER_APP_CLIENT_ID }}
28+
private-key: ${{ secrets.AI_JAVA_HELPER_APP_PRIVATE_KEY }}
29+
owner: xiang17
30+
repositories: azure-monitor-docs-pr
31+
permission-contents: write
32+
2333
- name: Repo sync
2434
# this step avoids having to do a deep fetch of the very large upstream repo
2535
# (cannot use "git fetch --depth 1 upstream main" because that leads to an error when
2636
# pushing below to the origin repo: "shallow update not allowed")
2737
env:
2838
VERSION: ${{ inputs.version }}
29-
# this is the personal access token used for "gh repo sync" below
30-
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
39+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
3140
run: |
3241
gh repo sync xiang17/azure-monitor-docs-pr \
3342
--source MicrosoftDocs/azure-monitor-docs-pr
3443
3544
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3645
with:
3746
repository: xiang17/azure-monitor-docs-pr
38-
# this is the personal access token used for "git push" below
39-
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
47+
token: ${{ steps.app-token.outputs.token }}
4048

4149
- name: Update version in docs
4250
env:
@@ -53,8 +61,7 @@ jobs:
5361
- name: Create pull request against azure-docs-pr
5462
env:
5563
VERSION: ${{ inputs.version }}
56-
# this is the personal access token used for "gh pr create" below
57-
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
64+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
5865
run: |
5966
message="Update the applicationinsights-java version to $VERSION"
6067
body="Update the applicationinsights-java version to \`$VERSION\`.

0 commit comments

Comments
 (0)