Skip to content

Commit 11cc9fb

Browse files
committed
[actions] use pull_request_target for amplify workflow
set environment to "external for forks, which is configured to require approval in the repository settings
1 parent 4d8e994 commit 11cc9fb

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/amplify.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Amplify Security
33
on:
4-
pull_request: {}
4+
pull_request_target: {}
55
workflow_dispatch: {}
66
push:
77
branches: ["main", "develop"]
@@ -11,12 +11,23 @@ permissions:
1111
id-token: write
1212

1313
jobs:
14+
authorize:
15+
environment:
16+
${{ github.event_name == 'pull_request_target' &&
17+
github.event.pull_request.head.repo.fork && 'external' || 'internal' }}
18+
runs-on: ubuntu-latest
19+
steps:
20+
- run: true
21+
1422
amplify-security-scan:
1523
name: Amplify Security Scan
24+
needs: authorize
1625
runs-on: ubuntu-latest
17-
if: (!github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]')
26+
if: github.actor != 'dependabot[bot]'
1827
steps:
1928
- name: Checkout
2029
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
30+
with:
31+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
2132
- name: Amplify Runner
2233
uses: amplify-security/runner-action@926f003f3c9695a93cbc4e2f1e64eb784dcacbfc # v0.2.0

0 commit comments

Comments
 (0)