Semgrep OSS scan #90
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 OSS scan | |
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", "main", "develop"] | |
# Schedule the CI job (this method uses cron syntax): | |
schedule: | |
- cron: '26 19 * * *' # Sets Semgrep to scan every day at 19:25 UTC. | |
# It is recommended to change the schedule to a random time. | |
jobs: | |
semgrep: | |
# User definable name of this GitHub Actions job. | |
name: semgrep-oss/scan | |
# 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: semgrep/semgrep | |
# Skip any PR created by dependabot to avoid permission issues: | |
if: (github.actor != 'dependabot[bot]') | |
steps: | |
# Fetch project source with GitHub Actions Checkout. | |
- name: checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: checkout to develop branch | |
run: | | |
git config --global --add safe.directory /__w/WebGoat/WebGoat | |
git remote -v | |
- name: scan on diff files only | |
run: | | |
cd $GITHUB_WORKSPACE | |
changed_files=$(git diff --name-only origin/develop) | |
for file in $changed_files | |
do | |
semgrep $file | |
done | |
# Run the "semgrep scan" command on the command line of the docker image. | |
# - run: semgrep scan --config auto #--output scan_results.json --json |