CI & GitHub code scanning
Fail the build on high-severity findings:
name: Worker Safety
on: pull_request: push: branches: [main]
jobs: worker-safety: runs-on: ubuntu-latest
steps: - uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2 with: php-version: '8.3' coverage: none
- run: composer install --no-interaction --no-progress
- run: vendor/bin/worker-safety scan --fail-on=high --no-ansiSARIF and code scanning
Section titled “SARIF and code scanning”Upload results to GitHub code scanning to get findings as annotations on the pull request diff:
name: Worker Safety (code scanning)
on: pull_request: push: branches: [main]
permissions: contents: read security-events: write
jobs: worker-safety: runs-on: ubuntu-latest
steps: - uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2 with: php-version: '8.3' coverage: none
- run: composer install --no-interaction --no-progress
# `--fail-on=never` so the SARIF always uploads; code scanning decides # what blocks the merge. - run: vendor/bin/worker-safety scan --format=sarif --fail-on=never > worker-safety.sarif
- uses: github/codeql-action/upload-sarif@v3 with: sarif_file: worker-safety.sarif category: worker-safetyBoth are reproduced in full above, and the repository keeps copies under
examples/workflows/. They live there rather than in its own
.github/workflows/ because they run vendor/bin/worker-safety, which exists
only once the package is installed as a dependency.