Skip to content

Commit 0d63df1

Browse files
authored
Add STAGING_URL check for ZAP scan execution
Added a check for STAGING_URL before running the ZAP scan to ensure it is set, and updated conditions for uploading artifacts.
1 parent fbc81af commit 0d63df1

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/advanced-security.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,28 @@ jobs:
148148
name: DAST - OWASP ZAP baseline
149149
runs-on: ubuntu-latest
150150
needs: prepare
151-
if: ${{ secrets.STAGING_URL != '' }}
152151
steps:
153152
- uses: actions/checkout@v4
154153

154+
- name: Check if STAGING_URL is set
155+
id: check_url
156+
run: |
157+
if [ -n "${{ secrets.STAGING_URL }}" ]; then
158+
echo "url_exists=true" >> $GITHUB_OUTPUT
159+
else
160+
echo "url_exists=false" >> $GITHUB_OUTPUT
161+
echo "STAGING_URL not set, skipping ZAP scan"
162+
fi
163+
155164
- name: Run ZAP baseline scan
165+
if: steps.check_url.outputs.url_exists == 'true'
156166
uses: zaproxy/[email protected]
157167
with:
158168
target: ${{ secrets.STAGING_URL }}
159169
rules_file_name: zap-rules.md
160170

161171
- name: Upload ZAP artifacts
162-
if: always()
172+
if: always() && steps.check_url.outputs.url_exists == 'true'
163173
uses: actions/upload-artifact@v4
164174
with:
165175
name: zap-output

0 commit comments

Comments
 (0)