Skip to content

Commit d7d3e0a

Browse files
committed
Move to using github app token
1 parent 2e054fb commit d7d3e0a

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

.github/workflows/create_ifu_tag.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21+
- name: Generate GitHub App token
22+
id: app-token
23+
uses: actions/create-github-app-token@v1
24+
with:
25+
app-id: ${{ secrets.APP_ID }}
26+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
27+
owner: rocm
28+
repositories: pytorch
29+
2130
- name: Checkout base repo (full history)
2231
uses: actions/checkout@v4
2332
with:
@@ -99,7 +108,7 @@ jobs:
99108
100109
- name: Append rocm_base & upstream_main to PR body
101110
env:
102-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111+
GH_TOKEN: ${{ steps.app-token.output.token }}
103112
shell: bash
104113
run: |
105114
set -euo pipefail

.github/workflows/pytorch_ifu.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,22 @@ jobs:
4646
DOWNSTREAM_REMOTE: origin # IFU target remote name
4747
DOWNSTREAM_REPO: ${{ inputs.ifu_target_repo }} # target repo for IFU (fork); actions/checkout sets this to origin
4848
DOWNSTREAM_BRANCH: ${{ inputs.ifu_target_branch }} # target branch for IFU
49-
GH_TOKEN: ${{ secrets.IFU_GITHUB_TOKEN }} # used by gh; provided by Action
5049
steps:
50+
- name: Generate GitHub App token
51+
id: app-token
52+
uses: actions/create-github-app-token@v1
53+
with:
54+
app-id: ${{ secrets.APP_ID }}
55+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
56+
owner: rocm
57+
repositories: pytorch
58+
5159
- name: Checkout repository (${{ env.DOWNSTREAM_REPO }}) (full history)
5260
uses: actions/checkout@v4
5361
with:
5462
repository: ${{ env.DOWNSTREAM_REPO }}
5563
path: ${{ env.DOWNSTREAM_REPO }}
5664
ref: ${{ env.DOWNSTREAM_BRANCH }}
57-
token: ${{ env.GH_TOKEN }}
5865
fetch-depth: 0 # need full history for merges/tags
5966
submodules: recursive
6067

@@ -115,18 +122,24 @@ jobs:
115122
116123
- name: Push branch & tag to fork
117124
working-directory: ${{ env.DOWNSTREAM_REPO }}
125+
env:
126+
GH_TOKEN: ${{ steps.app-token.output.token }}
118127
run: |
119128
git push ${DOWNSTREAM_REMOTE} "${{ steps.tag.outputs.TAG }}"
120129
121130
- name: Authenticate gh (non-interactive)
122131
working-directory: ${{ env.DOWNSTREAM_REPO }}
132+
env:
133+
GH_TOKEN: ${{ steps.app-token.output.token }}
123134
run: |
124135
# The GitHub-hosted runner has gh preinstalled.
125136
gh auth status || echo "$GH_TOKEN" | gh auth login --with-token
126137
gh repo set-default "${{ env.DOWNSTREAM_REPO }}"
127138
128139
- name: Create Pull Request with gh
129140
working-directory: ${{ env.DOWNSTREAM_REPO }}
141+
env:
142+
GH_TOKEN: ${{ steps.app-token.output.token }}
130143
run: |
131144
BASE="${DOWNSTREAM_BRANCH}"
132145
HEAD="${{ steps.tag.outputs.TAG }}"

0 commit comments

Comments
 (0)