Bandit #40
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: Bandit | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
schedule: | |
- cron: '36 12 * * 1' | |
jobs: | |
bandit: | |
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 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Create and activate virtual environment | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
- name: Install Bandit and SARIF formatter | |
run: | | |
venv/bin/pip install bandit bandit-sarif-formatter | |
- name: Run Bandit | |
run: | | |
venv/bin/bandit -r . -o results.sarif --format sarif | |
- name: Upload SARIF results to GitHub | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
sarif_file: results.sarif |