Skip to content

Commit fb8b27e

Browse files
authored
Fixes the pull_request_target usage to avoid the secret leak issue. (#193)
Signed-off-by: Tao He <[email protected]>
1 parent 6d9de18 commit fb8b27e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

.github/workflows/docs.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818
push:
1919
branches:
2020
- main
21-
pull_request_target:
21+
pull_request:
2222
branches:
2323
- main
2424
- docs
@@ -38,13 +38,13 @@ jobs:
3838
- name: Checkout Code
3939
uses: actions/checkout@v3
4040
with:
41-
repository: ${{github.event.pull_request.head.repo.full_name}}
42-
ref: ${{github.event.pull_request.head.ref}}
41+
repository: ${{ github.event.pull_request.head.repo.full_name }}
42+
ref: ${{ github.event.pull_request.head.ref }}
4343
submodules: true
4444
fetch-depth: 0
4545

4646
- name: Leave the comment on pull request when started
47-
if: ${{ github.event_name == 'pull_request_target' }}
47+
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'alibaba/GraphAr' }}
4848
uses: actions-cool/maintain-one-comment@v3
4949
with:
5050
token: ${{ secrets.GITHUB_TOKEN }}
@@ -71,15 +71,15 @@ jobs:
7171
popd
7272
7373
- name: Preview using surge
74-
if: ${{ github.event_name == 'pull_request_target' && github.repository == 'alibaba/GraphAr' }}
74+
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'alibaba/GraphAr' && github.repository == 'alibaba/GraphAr' }}
7575
run: |
7676
npm install -g surge
7777
surge ./docs/_build/html \
7878
alibaba-graphar-build-pr-${{ github.event.number }}.surge.sh \
7979
--token ${{ secrets.SURGE_TOKEN }}
8080
8181
- name: Leave the comment on pull request when succeed
82-
if: ${{ github.event_name == 'pull_request_target' }}
82+
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'alibaba/GraphAr' }}
8383
uses: actions-cool/maintain-one-comment@v3
8484
with:
8585
token: ${{ secrets.GITHUB_TOKEN }}
@@ -94,7 +94,7 @@ jobs:
9494
body-include: '<!-- Sticky Pull Request Comment: Surge Preview build -->'
9595

9696
- name: Leave the comment on pull request when failed
97-
if: ${{ failure() && github.event_name == 'pull_request_target' }}
97+
if: ${{ failure() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'alibaba/GraphAr' }}
9898
uses: actions-cool/maintain-one-comment@v3
9999
with:
100100
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)