File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Name of this GitHub Actions workflow.
2+ name: Semgrep
3+
4+ on:
5+ # Scan changed files in PRs (diff-aware scanning):
6+ # The branches below must be a subset of the branches above
7+ pull_request:
8+ branches: ["master", "main"]
9+ push:
10+ branches: ["master", "main"]
11+ schedule:
12+ - cron: '0 6 * * *'
13+
14+
15+ permissions:
16+ contents: read
17+
18+ jobs:
19+ semgrep:
20+ # User definable name of this GitHub Actions job.
21+ permissions:
22+ contents: read # for actions/checkout to fetch code
23+ security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
24+ name: semgrep/ci
25+ # If you are self-hosting, change the following `runs-on` value:
26+ runs-on: ubuntu-latest
27+
28+ container:
29+ # A Docker image with Semgrep installed. Do not change this.
30+ image: returntocorp/semgrep
31+
32+ # Skip any PR created by dependabot to avoid permission issues:
33+ if: (github.actor != 'dependabot[bot]')
34+
35+ steps:
36+ # Fetch project source with GitHub Actions Checkout.
37+ - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
38+ # Run the "semgrep ci" command on the command line of the docker image.
39+ - run: semgrep ci --sarif --output=semgrep.sarif
40+ env:
41+ # Add the rules that Semgrep uses by setting the SEMGREP_RULES environment variable.
42+ SEMGREP_RULES: p/default # more at semgrep.dev/explore
43+
44+ - name: Upload SARIF file for GitHub Advanced Security Dashboard
45+ uses: github/codeql-action/upload-sarif@6c089f53dd51dc3fc7e599c3cb5356453a52ca9e # v2.20.0
46+ with:
47+ sarif_file: semgrep.sarif
48+ if: always()
You can’t perform that action at this time.
0 commit comments