44 push :
55 branches :
66 - main
7- pull_request :
8- branches :
9- - " *"
7+ pull_request_target :
108 workflow_dispatch :
119
1210permissions :
@@ -15,7 +13,7 @@ permissions:
1513 actions : read
1614
1715concurrency :
18- group : build-test-ci-${{ github.ref }}
16+ group : build-test-ci-${{ github.event.pull_request.number || github.ref_name }}
1917 cancel-in-progress : true
2018
2119jobs :
2624 paths : ${{ steps.filter.outputs.changes }}
2725 steps :
2826 - uses : actions/checkout@v4
27+ with :
28+ ref : ${{ github.event.pull_request.head.sha }}
2929 - name : Harden Runner
3030 uses : step-security/harden-runner@v2
3131 with :
4545 if : ${{ contains(fromJSON(needs.changes.outputs.paths), 'src') }}
4646 steps :
4747 - uses : actions/checkout@v4
48+ with :
49+ ref : ${{ github.event.pull_request.head.sha }}
4850 - name : Validate YAML file
4951 run : yamllint templates
5052
7274 raw.githubusercontent.com:443
7375
7476 - uses : actions/checkout@v4
77+ with :
78+ ref : ${{ github.event.pull_request.head.sha }}
7579
7680 - name : Set up Go
7781 uses : actions/setup-go@v5
99103
100104 e2e-test :
101105 needs : changes
106+ environment : ${{ github.event.pull_request.head.repo.fork == true && 'prod-external' || 'prod' }}
102107 strategy :
103108 fail-fast : false
104109 matrix :
@@ -116,6 +121,7 @@ jobs:
116121
117122 docker-build :
118123 runs-on : ubuntu-latest
124+ environment : ${{ github.event.pull_request.head.repo.fork == true && 'prod-external' || 'prod' }}
119125 needs : changes
120126 if : ${{ contains(fromJSON(needs.changes.outputs.paths), 'src') }}
121127 steps :
@@ -140,6 +146,8 @@ jobs:
140146 storage.googleapis.com:443
141147
142148 - uses : actions/checkout@v4
149+ with :
150+ ref : ${{ github.event.pull_request.head.sha }}
143151
144152 - name : Docker cache
145153
0 commit comments