-
Notifications
You must be signed in to change notification settings - Fork 14
58 lines (56 loc) · 1.94 KB
/
tests-forks.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Run Test (forks & dependabot)
on:
pull_request_target:
types: [opened, synchronize, reopened, labeled]
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
permissions:
contents: read
issues: read # needed for the "labeled" event?
pull-requests: read # needed for the "labeled" event?
jobs:
# Makes it easier to see what was the input for this workflow in case we need to debug.
debug-event:
runs-on: ubuntu-latest
steps:
- name: Print workflow actor
run: echo "${{ toJSON(github.actor) }}"
- name: Print workflow event
run: jq '.' $GITHUB_EVENT_PATH
check-label:
name: Check label
runs-on: ubuntu-latest
# sender.login is needed for runs re-triggered from GitHub UI
if: |
(github.event.pull_request.user.login == 'dependabot[bot]' && contains(github.event.pull_request.labels.*.name, 'ok to test'))
|| (github.event.pull_request.head.repo.fork && contains(github.event.pull_request.labels.*.name, 'ok to test'))
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: remove labels
run: |
gh pr edit ${{ github.event.pull_request.number }} --remove-label "ok to test"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
unit-tests:
needs: [check-label]
if: needs.check-label.result == 'success'
uses: ./.github/workflows/unit-tests.yaml
name: Unit tests
security-tests:
name: Security tests
needs: [unit-tests]
if: needs.unit-tests.result == 'success'
uses: ./.github/workflows/security-tests.yaml
secrets: inherit
integration-tests:
name: Integration tests
needs: [unit-tests]
if: needs.unit-tests.result == 'success'
uses: ./.github/workflows/integration-tests.yaml
with:
cnspecImageTag: ""
secrets: inherit