11name : Pull Request Check
22
3- on :
4- pull_request_target :
5- types :
6- - opened
7- - synchronize
8- - labeled
9- - reopened
10-
11- permissions :
12- contents : read
13- pull-requests : read
3+ on : [ pull_request ]
144
155jobs :
16- check-user-trust :
17- runs-on : ubuntu-latest
18- outputs :
19- is-trusted : ${{ steps.check.outputs.is_trusted }}
20- steps :
21- - name : Check if PR sender is trusted
22- id : check
23- run : |
24- ASSOC="${{ github.event.sender.author_association }}"
25- echo "Sender association: $ASSOC"
26- if [[ "$ASSOC" == "OWNER" || "$ASSOC" == "MEMBER" || "$ASSOC" == "COLLABORATOR" ]]; then
27- echo "trusted=true" >> $GITHUB_OUTPUT
28- else
29- echo "trusted=false" >> $GITHUB_OUTPUT
30- fi
31-
32- compliant-check :
33- needs : check-user-trust
34- if : needs.check-user-trust.outputs.is_trusted == 'true'
6+ compliant :
357 runs-on : ubuntu-latest
368 steps :
379 - uses : actions/checkout@v4
4416 - name : Check Spell
4517 uses : crate-ci/typos@master
4618
47- golangci-lint :
48- needs : check-user-trust
49- if : needs.check-user-trust.outputs.is_trusted == 'true'
19+ lint :
5020 runs-on : ubuntu-latest
51- permissions :
52- pull-requests : write
5321 steps :
5422 - uses : actions/checkout@v4
5523 - name : Set up Go
6634 uses : golangci/golangci-lint-action@v6
6735 with :
6836 version : latest
69- only-new-issues : true
70-
71- unit-benchmark-test :
72- needs : check-user-trust
73- if : needs.check-user-trust.outputs.is_trusted == 'true'
74- runs-on : ubuntu-latest
75- steps :
76- - uses : actions/checkout@v4
77- - name : Set up Go
78- uses : actions/setup-go@v5
79- with :
80- go-version : stable
81-
82- - name : Unit Test
83- run : go test -race -coverprofile=coverage.out -covermode=atomic ./...
84-
85- - name : Benchmark
86- run : go test -bench=. -benchmem -run=none ./...
87-
88- compatibility-test :
89- needs : check-user-trust
90- if : needs.check-user-trust.outputs.is_trusted == 'true'
91- strategy :
92- matrix :
93- go : [ "1.19", oldstable ]
94- runs-on : ubuntu-latest
95- steps :
96- - uses : actions/checkout@v4
97- - name : Set up Go
98- uses : actions/setup-go@v5
99- with :
100- go-version : ${{ matrix.go }}
101- cache : true # don't use cache for self-hosted runners
102- - name : Unit Test
103- run : go test -race -covermode=atomic ./...
0 commit comments