-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
35 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,49 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# This workflow file requires a free account on Semgrep.dev to | ||
# manage rules, file ignores, notifications, and more. | ||
# | ||
# See https://semgrep.dev/docs | ||
|
||
# Name of this GitHub Actions workflow. | ||
name: Semgrep | ||
|
||
on: | ||
# Scan changed files in PRs (diff-aware scanning): | ||
pull_request: {} | ||
# Scan on-demand through GitHub Actions interface: | ||
workflow_dispatch: {} | ||
# Scan mainline branches and report all findings: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ "master" ] | ||
branches: ["master", "main"] | ||
# Schedule the CI job (this method uses cron syntax): | ||
schedule: | ||
- cron: '29 3 * * 0' | ||
|
||
- cron: '20 17 * * *' # Sets Semgrep to scan every day at 17:20 UTC. | ||
# It is recommended to change the schedule to a random time. | ||
|
||
permissions: | ||
actions: read | ||
contents: read | ||
|
||
security-events: write | ||
|
||
jobs: | ||
semgrep: | ||
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 | ||
name: Scan | ||
# User-definable name of this GitHub Actions job: | ||
name: semgrep/ci | ||
# If you are self-hosting, change the following `runs-on` value: | ||
runs-on: ubuntu-latest | ||
|
||
container: | ||
# A Docker image with Semgrep installed. Do not change this. | ||
image: returntocorp/semgrep | ||
|
||
# Skip any PR created by dependabot to avoid permission issues: | ||
if: (github.actor != 'dependabot[bot]') | ||
|
||
steps: | ||
# Checkout project source | ||
# Fetch project source with GitHub Actions Checkout. | ||
- uses: actions/checkout@v3 | ||
|
||
# Scan code using project's configuration on https://semgrep.dev/manage | ||
- uses: returntocorp/semgrep-action@fcd5ab7459e8d91cb1777481980d1b18b4fc6735 | ||
with: | ||
publishToken: ${{ secrets.SEMGREP_APP_TOKEN }} | ||
publishDeployment: ${{ secrets.SEMGREP_DEPLOYMENT_ID }} | ||
generateSarif: "1" | ||
|
||
# Upload SARIF file generated in previous step | ||
- name: Upload SARIF file | ||
# Run the "semgrep ci" command on the command line of the docker image. | ||
- run: semgrep ci --sarif --output=semgrep.sarif --exclude-rule yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha.third-party-action-not-pinned-to-commit-sha | ||
env: | ||
# Add the rules that Semgrep uses by setting the SEMGREP_RULES environment variable. | ||
SEMGREP_RULES: p/default # more at semgrep.dev/explore | ||
|
||
- name: Upload SARIF file for GitHub Advanced Security Dashboard | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: semgrep.sarif | ||
if: always() | ||
if: always() |