Skip to content

Commit 1d145ef

Browse files
committed
Allow integration tests from collaborators
1 parent c650976 commit 1d145ef

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

.github/workflows/integration-tests.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,44 @@ name: Integration tests
22

33
on:
44
push:
5-
branches:
6-
- master
5+
branches: [master]
6+
pull_request_target:
7+
branches: [master]
8+
types: [opened, synchronize, reopened]
79

810
jobs:
11+
decide-if-trusted:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
ok: ${{ steps.check.outputs.ok }}
15+
steps:
16+
- name: Trust gate
17+
id: check
18+
run: |
19+
# default to skip
20+
echo "ok=false" >> "$GITHUB_OUTPUT"
21+
22+
# Push events are always safe
23+
if [ "${{ github.event_name }}" = "push" ]; then
24+
echo "ok=true" >> "$GITHUB_OUTPUT"
25+
exit 0
26+
fi
27+
28+
# For PRs, look at the author's relationship
29+
case "${{ github.event.pull_request.author_association }}" in
30+
OWNER|MEMBER|COLLABORATOR|CONTRIBUTOR)
31+
echo "ok=true" >> "$GITHUB_OUTPUT"
32+
;;
33+
esac
34+
935
integration_tests:
10-
name: Run integration tests
36+
needs: decide-if-trusted
37+
if: needs.decide-if-trusted.outputs.ok == 'true'
1138
runs-on: ubuntu-latest
1239
steps:
1340
- uses: actions/checkout@v4
41+
with:
42+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
1443
- name: Setup Go
1544
uses: actions/setup-go@v5
1645
with:

0 commit comments

Comments
 (0)