periodical_vulnerability_scan #69
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
# GitHub action to run Snyk check for vulnerabilities in all requirement files. | |
name: periodical_vulnerability_scan | |
on: | |
schedule: # 1 for Monday, 2 for Tuesday, etc. | |
- cron: "0 12 * * 1" | |
workflow_dispatch: # run manually | |
jobs: | |
periodical_vulnerability_scan: | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- name: Checkout (GitHub) | |
uses: actions/checkout@v3 | |
- name: Login to GitHub Container Registry | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
- name: Get git branches | |
run: | | |
git fetch origin main | |
git branch | |
- name: Install dependencies | |
shell: bash | |
run: | | |
pip install invoke | |
inv install-requirements | |
- name: Install snyk | |
run: npm install -g snyk | |
- name: Run Snyk to check for vulnerabilities | |
id: snyk | |
continue-on-error: true | |
env: | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
run: | | |
inv vulnerability-scan | |
- name: Create issue | |
if: steps.snyk.outcome != 'success' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh issue create --title "Vulnerability scan failed" --body "Vulnerability scan in periodical GitHub Action failed. Please check the logs." --assignee sarakolding,frillecode,soerendinesen2,andrdani,bokajgd |