Skip to content

Commit 78f970c

Browse files
committed
feat(docs): use GitHub App token for docs-real workflow
Replace GITHUB_TOKEN with GitHub App token (APP_ID/APP_PRIVATE_KEY) for cross-repo API calls in docs-real.yml, consistent with ci-real.yml. Also add git url config for repo sync and fetch PR steps.
1 parent 8e519ef commit 78f970c

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

.github/workflows/docs-real.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,18 @@ jobs:
3232
echo "Current Action URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
3333
echo "CURRENT_ACTION_URL=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV
3434
35+
- name: Generate App Token
36+
id: app-token
37+
uses: actions/create-github-app-token@v1
38+
with:
39+
app-id: ${{ secrets.APP_ID }}
40+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
41+
owner: open-vela
42+
3543
- name: Parse PR Description for Dependencies
3644
id: parse-dependencies
3745
env:
38-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
3947
PR_NUMBER: ${{ github.event.pull_request.number }}
4048
PR_REPO: ${{ github.repository }}
4149
run: |
@@ -155,14 +163,20 @@ jobs:
155163
echo "REPO_INIT=true" >> $GITHUB_ENV
156164
157165
- name: Repo Sync
166+
env:
167+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
158168
run: |
169+
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
159170
df -h
160171
~/bin/repo sync -c -d --no-tags -j12
161172
df -h
162173
163174
- name: Fetch PR
164175
if: ${{ github.event_name == 'pull_request_target' || github.event_name == 'workflow_call' }}
176+
env:
177+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165178
run: |
179+
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
166180
current_path=$(pwd)
167181
echo "REPO_ROOT=$current_path" >> $GITHUB_ENV
168182
echo $(ls -atl)
@@ -257,10 +271,19 @@ jobs:
257271
fi
258272
fi
259273
274+
- name: Generate App Token for Post Processing
275+
if: always()
276+
id: app-token-post
277+
uses: actions/create-github-app-token@v1
278+
with:
279+
app-id: ${{ secrets.APP_ID }}
280+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
281+
owner: open-vela
282+
260283
- name: Post Processing
261284
if: always()
262285
env:
263-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
286+
GH_TOKEN: ${{ steps.app-token-post.outputs.token }}
264287
run: |
265288
echo "Job status: ${{ job.status }}"
266289

0 commit comments

Comments
 (0)