File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : Validate newly added JSON
22
33on :
4- pull_request :
4+ pull_request_target :
55 types :
66 - opened
77 - synchronize
88
9+ permissions :
10+ contents : read
11+
912jobs :
1013 validate-json :
1114 runs-on : ubuntu-latest
@@ -15,11 +18,19 @@ jobs:
1518 uses : actions/checkout@v4
1619 with :
1720 fetch-depth : 2
21+ ref : refs/pull/${{ github.event.pull_request.number }}/merge
22+ persist-credentials : false
1823
1924 # Must be done before setup-node.
2025 - name : Enable Corepack
2126 run : corepack enable
2227
28+ # We are using `pull_request_target`, meaning untrusted code could access the secrets.
29+ # For PRs from forks, we want to rollback to the trusted version of `actions/`. Other
30+ # directories do not contain any runnable code.
31+ - if : github.event.pull_request.head.repo.full_name != github.repository
32+ run : git checkout HEAD^ -- actions/
33+
2334 - name : Setup Node.js
2435 uses : actions/setup-node@v4
2536 with :
You can’t perform that action at this time.
0 commit comments