Skip to content

Fixes the pull_request_target usage to avoid the secret leak issue. #193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
push:
branches:
- main
pull_request_target:
pull_request:
branches:
- main
- docs
Expand All @@ -38,13 +38,13 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v3
with:
repository: ${{github.event.pull_request.head.repo.full_name}}
ref: ${{github.event.pull_request.head.ref}}
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
submodules: true
fetch-depth: 0

- name: Leave the comment on pull request when started
if: ${{ github.event_name == 'pull_request_target' }}
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'alibaba/GraphAr' }}
uses: actions-cool/maintain-one-comment@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -71,15 +71,15 @@ jobs:
popd

- name: Preview using surge
if: ${{ github.event_name == 'pull_request_target' && github.repository == 'alibaba/GraphAr' }}
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'alibaba/GraphAr' && github.repository == 'alibaba/GraphAr' }}
run: |
npm install -g surge
surge ./docs/_build/html \
alibaba-graphar-build-pr-${{ github.event.number }}.surge.sh \
--token ${{ secrets.SURGE_TOKEN }}

- name: Leave the comment on pull request when succeed
if: ${{ github.event_name == 'pull_request_target' }}
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'alibaba/GraphAr' }}
uses: actions-cool/maintain-one-comment@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -94,7 +94,7 @@ jobs:
body-include: '<!-- Sticky Pull Request Comment: Surge Preview build -->'

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