77 pull_request :
88 workflow_dispatch :
99
10+ env :
11+ GO_VERSION : " 1.25.0"
12+ CLI_IMAGE : escape-cli:pr-${{ github.sha }}
13+
1014jobs :
11- validate -action-definition :
15+ github -action-tests :
1216 runs-on : ubuntu-latest
1317 steps :
1418 - uses : actions/checkout@v6
1519
20+ - uses : actions/setup-go@v5
21+ with :
22+ go-version : ${{ env.GO_VERSION }}
23+
24+ - uses : goreleaser/goreleaser-action@v6
25+ with :
26+ install-only : true
27+
28+ - name : Build CLI image
29+ run : goreleaser release --snapshot --clean --skip=archive
30+
31+ - name : Tag image for action
32+ run : docker tag goreleaser.ko.local:latest "${CLI_IMAGE}"
33+
1634 - name : Verify action.yml structure
1735 run : |
1836 python3 -c "
@@ -32,57 +50,46 @@ jobs:
3250 print('action.yml is valid')
3351 "
3452
35- test-missing-profile-id :
36- runs-on : ubuntu-latest
37- steps :
38- - uses : actions/checkout@v6
39-
4053 - name : Run action without profile_id
41- id : run
54+ id : missing_profile
4255 continue-on-error : true
4356 uses : ./
4457 with :
4558 api_key : " fake-key-for-testing"
59+ cli_image : ${{ env.CLI_IMAGE }}
4660
47- - name : Assert failure
48- if : steps.run .outcome == 'success'
61+ - name : Assert failure when profile_id is missing
62+ if : steps.missing_profile .outcome == 'success'
4963 run : |
5064 echo "Expected action to fail when profile_id is missing"
5165 exit 1
5266
53- test-missing-api-key :
54- runs-on : ubuntu-latest
55- steps :
56- - uses : actions/checkout@v4
57-
5867 - name : Run action without api_key
59- id : run
68+ id : missing_api_key
6069 continue-on-error : true
6170 uses : ./
6271 with :
6372 profile_id : " fake-profile-id"
73+ cli_image : ${{ env.CLI_IMAGE }}
6474
65- - name : Assert failure
66- if : steps.run .outcome == 'success'
75+ - name : Assert failure when api_key is missing
76+ if : steps.missing_api_key .outcome == 'success'
6777 run : |
6878 echo "Expected action to fail when api_key is missing"
6979 exit 1
7080
71- test-start-scan :
72- runs-on : ubuntu-latest
73- if : ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
74- steps :
75- - uses : actions/checkout@v6
76-
7781 - name : Require E2E secrets
82+ if : ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
7883 run : |
7984 if [ -z "${{ secrets.E2E_API_KEY }}" ] || [ -z "${{ secrets.E2E_PROFILE_ID }}" ]; then
8085 echo "::error::Configure repository secrets E2E_API_KEY and E2E_PROFILE_ID for the Escape DAST scan."
8186 exit 1
8287 fi
8388
8489 - name : Run Escape DAST scan
90+ if : ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
8591 uses : ./
8692 with :
8793 profile_id : ${{ secrets.E2E_PROFILE_ID }}
8894 api_key : ${{ secrets.E2E_API_KEY }}
95+ cli_image : ${{ env.CLI_IMAGE }}
0 commit comments