Semgrep #27
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: Semgrep | |
on: | |
pull_request: {} | |
workflow_dispatch: {} | |
push: | |
branches: ["master", "main"] | |
schedule: | |
- cron: '20 5 * * *' | |
jobs: | |
semgrep: | |
name: semgrep/ci | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
container: | |
image: semgrep/semgrep:latest | |
options: --memory=4g --cpus="2" | |
if: (github.actor != 'dependabot[bot]') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run Semgrep CI with debug | |
run: | | |
semgrep ci --sarif > semgrep.sarif || { echo "Semgrep CI failed"; exit 1; } | |
env: | |
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} | |
- name: Debug SARIF output | |
run: | | |
cat semgrep.sarif || echo "semgrep.sarif file is missing or empty" | |
- name: Validate SARIF file | |
run: | | |
jq . semgrep.sarif | |
if: always() | |
- name: Upload SARIF file for GitHub Advanced Security Dashboard | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: semgrep.sarif | |
if: success() && hashFiles('semgrep.sarif') |