Skip to content

Add Snyk Security workflow to monitor multiple tags #750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,21 @@ on:
type: string
default: "project-codeflare"

env:
PR_BRANCH_NAME: snyk-tag-monitoring-${{ github.run_id }}

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write # This permission is required for trusted publishing
pull-requests: write # This permission is required for creating PRs
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_CLI_TOKEN }}
- name: Install Python
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -81,3 +87,21 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash

- name: Install Snyk CLI and setup monitoring for new release tag
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
SNYK_ORG: ${{ secrets.SNYK_ORG }}
run: |
echo "Installing Snyk CLI"
npm install -g snyk

echo "Fetching tags"
git fetch origin 'refs/tags/*:refs/tags/*'

echo "Authenticating with Snyk"
snyk auth ${SNYK_TOKEN}

echo "Scanning project: codeflare-sdk/v${{ github.event.inputs.release-version }}"
git checkout v${{ github.event.inputs.release-version }}
snyk monitor --all-projects --exclude=requirements.txt --org=${SNYK_ORG} --target-reference="$(git describe --tags)"
29 changes: 29 additions & 0 deletions .github/workflows/snyk-security.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Snyk Security
on:
push:
branches:
- main

jobs:
snyk-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Snyk CLI
run: npm install -g snyk

- name: Snyk Monitor and Test multiple projects
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
SNYK_ORG: ${{ secrets.SNYK_ORG }}
run: |
echo "Fetching tags"
git fetch origin 'refs/tags/*:refs/tags/*'

echo "Authenticating with Snyk"
snyk auth ${SNYK_TOKEN}

echo "Scanning project: codeflare-sdk/main"
snyk monitor --all-projects --exclude=requirements.txt --org=${SNYK_ORG} --target-reference="main"