77 types : [opened, synchronize, reopened]
88
99env :
10- PHP_VERSION : ' 8.0' # Change to 8.2/ 8.3 if needed
10+ PHP_VERSION : ' 8.0' # Adjust if you prefer 8.2 or 8.3
1111
1212jobs :
1313 prepare :
1919 - name : Checkout
2020 uses : actions/checkout@v4
2121
22- - name : Setup PHP
23- uses : shivammathur/setup-php@v3
22+ - name : Set up PHP
23+ uses : shivammathur/setup-php@v2
2424 with :
2525 php-version : ${{ env.PHP_VERSION }}
2626 extensions : mbstring, intl, pdo, pdo_mysql, ftp
@@ -47,10 +47,13 @@ jobs:
4747 - uses : actions/checkout@v4
4848
4949 - name : Setup PHP
50- uses : shivammathur/setup-php@v3
50+ uses : shivammathur/setup-php@v2
5151 with :
5252 php-version : ${{ env.PHP_VERSION }}
5353
54+ - name : Install composer deps
55+ run : composer install --no-interaction --prefer-dist || true
56+
5457 - name : Composer audit
5558 run : composer audit --format=json > composer-audit.json || true
5659
6265 path : composer-audit.json
6366
6467 - name : Add Roave security advisory
65- run : composer require --dev roave/security-advisories:^1 || true
68+ run : composer require --dev roave/security-advisories:dev-latest --no-update || true
6669
6770 semgrep :
6871 name : Semgrep SAST Scan
@@ -71,15 +74,11 @@ jobs:
7174 steps :
7275 - uses : actions/checkout@v4
7376
74- - name : Install Semgrep
77+ - name : Run Semgrep scan
7578 run : |
7679 python3 -m pip install --user semgrep
7780 export PATH="$HOME/.local/bin:$PATH"
7881 semgrep --version
79-
80- - name : Run Semgrep scan
81- run : |
82- export PATH="$HOME/.local/bin:$PATH"
8382 semgrep --config p/php --json --output semgrep-report.json || true
8483
8584 - name : Upload Semgrep report
@@ -98,10 +97,13 @@ jobs:
9897 - uses : actions/checkout@v4
9998
10099 - name : Setup PHP
101- uses : shivammathur/setup-php@v3
100+ uses : shivammathur/setup-php@v2
102101 with :
103102 php-version : ${{ env.PHP_VERSION }}
104103
104+ - name : Install composer deps
105+ run : composer install --no-interaction --prefer-dist || true
106+
105107 - name : Run PHPStan if present
106108 run : |
107109 if [ -x vendor/bin/phpstan ]; then
@@ -132,56 +134,53 @@ jobs:
132134 runs-on : ubuntu-latest
133135 steps :
134136 - uses : actions/checkout@v4
135- - name : Run Gitleaks
136- uses : zricethezav/gitleaks-action@v2
137- with :
138- args : detect --source . --report-format json --report-path gitleaks-report.json || true
139- - name : Upload Gitleaks report
140- if : always()
141- uses : actions/upload-artifact@v4
142137 with :
143- name : gitleaks-report
144- path : gitleaks-report.json
138+ fetch-depth : 0
139+
140+ - name : Run Gitleaks
141+ uses : gitleaks/gitleaks-action@v2
142+ env :
143+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
144+ GITLEAKS_ENABLE_SUMMARY : true
145+ continue-on-error : true
145146
146147 dast-zap :
147148 name : DAST - OWASP ZAP baseline
148149 runs-on : ubuntu-latest
149150 needs : prepare
151+ if : ${{ secrets.STAGING_URL != '' }}
150152 steps :
151- - name : Check STAGING_URL secret
152- run : |
153- if [ -z "${{ secrets.STAGING_URL }}" ]; then
154- echo "STAGING_URL not set, skipping ZAP scan"
155- exit 0
156- fi
153+ - uses : actions/checkout@v4
157154
158155 - name : Run ZAP baseline scan
159- uses : zaproxy/action-baseline@v1
156+ uses : zaproxy/action-baseline@v0.12.0
160157 with :
161158 target : ${{ secrets.STAGING_URL }}
162159 rules_file_name : zap-rules.md
163- format : ' github'
164160
165161 - name : Upload ZAP artifacts
162+ if : always()
166163 uses : actions/upload-artifact@v4
167164 with :
168165 name : zap-output
169- path : .
166+ path : zap_scan_report.*
170167
171168 dependency-review :
172169 name : GitHub Dependency Review
173170 runs-on : ubuntu-latest
171+ if : github.event_name == 'pull_request'
174172 steps :
175173 - uses : actions/checkout@v4
176174 - name : Run Dependency Review
177- uses : github /dependency-review-action@v2
175+ uses : actions /dependency-review-action@v4
178176 with :
179177 token : ${{ secrets.GITHUB_TOKEN }}
180178
181179 summary :
182180 name : Summary
183181 runs-on : ubuntu-latest
184- needs : [dependency-audit, semgrep, sast-php, secret-scan, dast-zap, dependency-review]
182+ needs : [dependency-audit, semgrep, sast-php, secret-scan]
183+ if : always()
185184 steps :
186185 - name : Print summary
187186 run : |
0 commit comments