Skip to content

Merge pull request #24688 from backstage/changeset-release/master #4283

Merge pull request #24688 from backstage/changeset-release/master

Merge pull request #24688 from backstage/changeset-release/master #4283

name: Sync Snyk Monitoring
on:
workflow_dispatch:
push:
branches: [master]
paths:
- '.github/workflows/sync_snyk-monitor.yml'
- '**/.snyk'
- '**/package.json'
- 'yarn.lock'
# This workflow synchronizes the packages in this repo along with policies in
# each .snyk file with the remote state in our snyk org. It allows us to define
# ignore policies in the .snyk files and then have them show up in the snyk web
# UI, and also automatically adds any new packages that are created.
permissions:
contents: read
jobs:
sync:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
with:
egress-policy: audit
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- name: Monitor and Synchronize Snyk Policies
uses: snyk/actions/node@8349f9043a8b7f0f3ee8885bf28f0b388d2446e8 # master
with:
command: monitor
args: >
--yarn-workspaces
--org=backstage-dgh
--strict-out-of-sync=false
--remote-repo-url=https://github.com/backstage/backstage
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
NODE_OPTIONS: --max-old-space-size=7168
# Above we run the `monitor` command, this runs the `test` command which is
# the one that generates the SARIF report that we can upload to GitHub.
- name: Create Snyk report
uses: snyk/actions/node@8349f9043a8b7f0f3ee8885bf28f0b388d2446e8 # master
continue-on-error: true # To make sure that SARIF upload gets called
with:
args: >
--yarn-workspaces
--org=backstage-dgh
--strict-out-of-sync=false
--sarif-file-output=snyk.sarif
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
NODE_OPTIONS: --max-old-space-size=7168
- name: Upload Snyk report
uses: github/codeql-action/upload-sarif@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3
with:
sarif_file: snyk.sarif