Skip to content

Commit

Permalink
fix: allow forked PRs to access repo secrets
Browse files Browse the repository at this point in the history
Signed-off-by: Mason Hu <[email protected]>
  • Loading branch information
mas-who committed Sep 13, 2024
1 parent dbdcc21 commit 62c8606
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: PR checks
on: pull_request
on: [pull_request, pull_request_target]

permissions:
contents: read

jobs:

commits:
if: github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork
permissions:
pull-requests: read # to get list of commits from the PR
name: Canonical CLA signed and Signed-off-by (DCO)
Expand All @@ -25,8 +26,8 @@ jobs:
commits: ${{ steps.get-pr-commits.outputs.commits }}

lint-scss:
if: github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

Expand All @@ -37,8 +38,8 @@ jobs:
run: yarn lint-scss

lint-js:
if: github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

Expand All @@ -49,8 +50,8 @@ jobs:
run: yarn lint-js

check-inclusive-naming:
if: github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -63,6 +64,7 @@ jobs:
fail-on-error: true

browser-e2e-test:
if: github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork
environment: ci-end-to-end
name: e2e-tests
runs-on: ubuntu-latest
Expand Down Expand Up @@ -178,7 +180,7 @@ jobs:
retention-days: 1

merge-e2e-reports:
if: always()
if: github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork
needs: [browser-e2e-test]
env:
HTML_REPORT_URL_PATH: reports/pr-${{ github.event.number }}/${{ github.run_id }}/${{ github.run_attempt }}
Expand Down Expand Up @@ -222,6 +224,7 @@ jobs:
echo "Please wait a few minute for the reports to get published before accessing the url!"
js-tests:
if: github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork
name: js-tests
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit 62c8606

Please sign in to comment.