Chore #714 : Optimze Github Actions #1296
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DAST with ZAP | |
on: | |
pull_request: | |
branches: [master] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
test-dast: | |
name: DAST test with ZAP | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
- name: Check the cache | |
uses: actions/cache/restore@v3 | |
id: cache | |
with: | |
path: ./target | |
key: JarCache-${{ runner.os }}-${{ hashFiles('**/pom.xml') }} | |
restore-keys: jar- | |
- name: Check cache hit | |
id: cache-hit-check | |
run: echo "cache-hit=${{ steps.cache.outputs.cache-hit }}" >> $GITHUB_ENV | |
# - name: Set up JDK 21 | |
# uses: actions/setup-java@v3 | |
# with: | |
# java-version: "21" | |
# distribution: "corretto" | |
# - name: Clean install | |
# run: ./mvnw --no-transfer-progress clean install -DskipTests -Ddependency-check.skip -Dcyclonedx.skip=true -Dexec.skip | |
# - name: Cache JAR file | |
# id: cache-jar | |
# uses: actions/cache@v3 | |
# with: | |
# path: ./target/wrongsecrets-1.7.0-SNAPSHOT.jar | |
# key: JarCache-${{ runner.os }}-${{ hashFiles('**/pom.xml') }} | |
# restore-keys: | | |
# JarCache-${{ runner.os }}- | |
- name: Trigger Building JAR cache | |
if: steps.cache.outputs.cache-hit != 'true' | |
uses: actions/checkout@v2 | |
with: | |
repository: owner/repo | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: .github/workflows/building-jar-cache.yml | |
- name: Run Building JAR cache workflow | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: gh workflow run "Building JAR cache" --ref main | |
- name: Start wrongsecrets | |
run: nohup ./mvnw spring-boot:run -Dspring-boot.run.profiles=without-vault & | |
- name: ZAP Scan | |
uses: zaproxy/[email protected] | |
env: | |
ZAP_AUTH_HEADER_VALUE: "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" | |
ZAP_AUTH_HEADER: "Authorization" | |
with: | |
allow_issue_writing: false | |
docker_name: "owasp/zap2docker-stable" | |
target: "http://localhost:8080" | |
rules_file_name: config/zap/rule-config.tsv | |
fail_action: true | |
cmd_options: '-z "-configFile /zap/wrk/config/zap/options.prop"' |