Skip to content

Commit 75bf193

Browse files
committed
Change trigger event to pr target
Signed-off-by: Jie Chen <jiechen3@microsoft.com>
1 parent d805cf3 commit 75bf193

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: CI
2+
permissions: read-all
23
on:
3-
- push
4-
- pull_request
4+
pull_request_target:
5+
branches: ["jiechen3/github_runner"]
56

67
env:
78
GO_BUILD_CMD: 'go build "-ldflags=-s -w" -trimpath'
@@ -19,8 +20,25 @@ env:
1920
LINUX_BOOT_FILES_PATH: ${{ github.workspace }}/LinuxBootFiles
2021

2122
jobs:
23+
check-access:
24+
runs-on:
25+
- ubuntu-latest
26+
steps:
27+
- name: Check access
28+
run: |
29+
if [[ "${{ github.event.pull_request.author_association }}" != "COLLABORATOR" && \
30+
"${{ github.event.pull_request.author_association }}" != "CONTRIBUTOR" && \
31+
"${{ github.event.pull_request.author_association }}" != "OWNER" ]]; then
32+
echo "Author association: ${{ github.event.pull_request.author_association }}"
33+
echo "Event not triggered by a collaborator/contributor/owner. Will not continue CI."
34+
exit 1
35+
else
36+
echo "Triggering actor is a ${{ github.event.pull_request.author_association }}. Continuing CI."
37+
fi
38+
2239
lint:
2340
runs-on: "windows-2022"
41+
needs: [check-access]
2442
strategy:
2543
fail-fast: false
2644
matrix:
@@ -57,6 +75,8 @@ jobs:
5775
protos:
5876
runs-on: "windows-2022"
5977

78+
needs: [check-access]
79+
6080
env:
6181
# translating from github.com/Microsoft/hcsshim/<path> (via `go list`) to <path> is easier if hcsshim is in GOPATH/src
6282
GOPATH: '${{ github.workspace }}\go'
@@ -118,6 +138,7 @@ jobs:
118138
working-directory: "${{ github.workspace }}/go/src/github.com/Microsoft/hcsshim"
119139

120140
verify-vendor:
141+
needs: [check-access]
121142
runs-on: "windows-2022"
122143
env:
123144
GOPROXY: "https://proxy.golang.org,direct"
@@ -185,6 +206,7 @@ jobs:
185206
186207
go-gen:
187208
name: Go Generate
209+
needs: [check-access]
188210
runs-on: "windows-2022"
189211
steps:
190212
- name: Checkout
@@ -242,6 +264,7 @@ jobs:
242264
# create the rootfs containing the local Linux-GCS. It needs to be run on
243265
# the 1ES github runner pool in order to access the Azure Artifact feed.
244266
create-linux-boot-files:
267+
needs: [check-access]
245268
runs-on:
246269
- self-hosted
247270
- 1ES.Pool=containerplat-github-runner-pool-east-us-2

0 commit comments

Comments
 (0)