Update snyk-security.yml #7
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: Snyk Security | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
permissions: | |
contents: read | |
jobs: | |
snyk: | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | |
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' # Specify the PHP version | |
- name: Install PHP dependencies | |
run: composer install | |
- name: Set up Snyk CLI to check for security issues | |
uses: snyk/actions/setup@806182742461562b67788a64410098c9d9b96adb | |
env: | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
- name: Snyk Code test | |
run: snyk code test --sarif > snyk-code.sarif # || true | |
- name: Snyk Open Source test | |
run: snyk test --severity-threshold=high --all-projects | |
- name: Snyk Open Source monitor | |
run: snyk monitor --all-projects | |
- name: Upload result to GitHub Code Scanning | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: snyk-code.sarif |