Skip to content

Commit c2c2a5d

Browse files
committed
chore: update pr-check template for security
Change-Id: Ic99cc4a2bd6aec38cb6746ab56cb1fe3c15dc8ec
1 parent 66b1665 commit c2c2a5d

1 file changed

Lines changed: 30 additions & 3 deletions

File tree

.github/workflows/pr-check.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,33 @@
11
name: Pull Request Check
22

3-
on: [ pull_request ]
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- synchronize
8+
- labeled
9+
- reopened
410

511
jobs:
6-
compliant:
12+
check-user-trust:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
is-trusted: ${{ steps.check.outputs.is_trusted }}
16+
steps:
17+
- name: Check if PR sender is trusted
18+
id: check
19+
run: |
20+
ASSOC="${{ github.event.sender.author_association }}"
21+
echo "Sender association: $ASSOC"
22+
if [[ "$ASSOC" == "OWNER" || "$ASSOC" == "MEMBER" || "$ASSOC" == "COLLABORATOR" ]]; then
23+
echo "trusted=true" >> $GITHUB_OUTPUT
24+
else
25+
echo "trusted=false" >> $GITHUB_OUTPUT
26+
fi
27+
28+
compliant-check:
29+
needs: check-user-trust
30+
if: needs.check-user-trust.outputs.is_trusted == 'true'
731
runs-on: ubuntu-latest
832
steps:
933
- uses: actions/checkout@v4
@@ -16,7 +40,9 @@ jobs:
1640
- name: Check Spell
1741
uses: crate-ci/typos@master
1842

19-
lint:
43+
golangci-lint:
44+
needs: check-user-trust
45+
if: needs.check-user-trust.outputs.is_trusted == 'true'
2046
runs-on: ubuntu-latest
2147
steps:
2248
- uses: actions/checkout@v4
@@ -34,3 +60,4 @@ jobs:
3460
uses: golangci/golangci-lint-action@v6
3561
with:
3662
version: latest
63+
only-new-issues: true

0 commit comments

Comments
 (0)