Skip to content

Commit

Permalink
Change trigger event to pr target
Browse files Browse the repository at this point in the history
Signed-off-by: Jie Chen <jiechen3@microsoft.com>
  • Loading branch information
jiechen0826 committed Feb 18, 2025
1 parent d805cf3 commit 0c7338d
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: CI
permissions: read-all
on:
- push
- pull_request
pull_request_target:
branches: ["jiechen3/github_runner"]

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

jobs:
check-access:
runs-on:
- ubuntu-latest
steps:
- name: Check access
run: |
if [[ "${{ github.event.pull_request.author_association }}" != "COLLABORATOR" && \
"${{ github.event.pull_request.author_association }}" != "CONTRIBUTOR" && \
"${{ github.event.pull_request.author_association }}" != "OWNER" ]]; then
echo "Author association: ${{ github.event.pull_request.author_association }}"
echo "Event not triggered by a collaborator/contributor/owner. Will not continue CI."
exit 1
else
echo "Author is a collaborator/contributor/owner. Continuing CI."
fi
lint:
runs-on: "windows-2022"
needs: [check-access]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -57,6 +75,8 @@ jobs:
protos:
runs-on: "windows-2022"

needs: [check-access]

env:
# translating from github.com/Microsoft/hcsshim/<path> (via `go list`) to <path> is easier if hcsshim is in GOPATH/src
GOPATH: '${{ github.workspace }}\go'
Expand Down Expand Up @@ -118,6 +138,7 @@ jobs:
working-directory: "${{ github.workspace }}/go/src/github.com/Microsoft/hcsshim"

verify-vendor:
needs: [check-access]
runs-on: "windows-2022"
env:
GOPROXY: "https://proxy.golang.org,direct"
Expand Down Expand Up @@ -185,6 +206,7 @@ jobs:
go-gen:
name: Go Generate
needs: [check-access]
runs-on: "windows-2022"
steps:
- name: Checkout
Expand Down Expand Up @@ -242,6 +264,7 @@ jobs:
# create the rootfs containing the local Linux-GCS. It needs to be run on
# the 1ES github runner pool in order to access the Azure Artifact feed.
create-linux-boot-files:
needs: [check-access]
runs-on:
- self-hosted
- 1ES.Pool=containerplat-github-runner-pool-east-us-2
Expand Down

0 comments on commit 0c7338d

Please sign in to comment.