Skip to content

Commit c8eecfb

Browse files
authored
🔒 Create security.yml
1 parent 3cb82a0 commit c8eecfb

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

‎.github/workflows/security.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# This is the name of the workflow, it appears in the GitHub Actions tab
2+
name: Security Checks
3+
4+
# The name for workflow runs generated from this workflow
5+
run-name: Security Check on ${{ github.ref }} by @${{ github.actor }}
6+
7+
# This specifies the events that will trigger the workflow to run
8+
on: [push, pull_request]
9+
10+
jobs:
11+
setup:
12+
uses: ./.github/workflows/setup_environment.yml
13+
with:
14+
python-version: '3.12'
15+
16+
# This job runs Bandit for security checks
17+
bandit:
18+
needs: setup
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Install Bandit
25+
run: pip install bandit
26+
27+
- name: Run Bandit
28+
run: bandit -r . --exclude ./tests/
29+
30+
# This job runs Safety for security checks
31+
safety:
32+
needs: setup
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
38+
- name: Install Poetry
39+
run: |
40+
curl -sSL https://install.python-poetry.org | python3 -
41+
42+
- name: Generate requirements.txt from Poetry
43+
run: |
44+
poetry export -f requirements.txt --output requirements.txt --without-hashes
45+
46+
- name: Install Safety
47+
run: pip install safety
48+
49+
- name: Run Safety
50+
run: safety check -r requirements.txt

0 commit comments

Comments
 (0)