1- name : safety - Python Dependency Check (Overridden)
1+ name : safety - Python Dependency Check
22
33on :
44 pull_request :
77 push :
88
99jobs :
10- Safety-Override :
10+ Linting :
1111 runs-on : ubuntu-latest
12+ strategy :
13+ fail-fast : true
14+ matrix :
15+ python-version : [3.12]
1216 steps :
13- - name : Override original safety check
17+ # ----------------------------------------------
18+ # check-out repo and set-up python
19+ # ----------------------------------------------
20+ - name : Check out repository
21+ uses : actions/checkout@v3
22+ - name : Set up python
23+ id : setup-python
24+ uses : actions/setup-python@v3
25+ with :
26+ python-version : 3.12
27+ # ----------------------------------------------
28+ # ----- install & configure poetry -----
29+ # ----------------------------------------------
30+ - name : Load Cached Poetry Installation
31+ uses : actions/cache@v3
32+ with :
33+ path : ~/.local # the path depends on the OS
34+ key : poetry-no-dev-2 # increment to reset cache
35+ - name : Install Poetry
36+ uses : snok/install-poetry@v1
37+ with :
38+ virtualenvs-create : true
39+ virtualenvs-in-project : true
40+ installer-parallel : true
41+ # ----------------------------------------------
42+ # load cached venv if cache exists
43+ # ----------------------------------------------
44+ - name : Load cached venv
45+ id : cached-poetry-no-dev-dependencies
46+ uses : actions/cache@v3
47+ with :
48+ path : .venv
49+ key : venv-no-dev-dependencies-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
50+ # ----------------------------------------------
51+ # install dependencies if cache does not exist
52+ # ----------------------------------------------
53+ - name : Install dependencies
54+ if : steps.cached-poetry-no-dev-dependencies.outputs.cache-hit != 'true'
55+ run : poetry install --only main --no-root
56+ # ----------------------------------------------
57+ # Run Safety scan
58+ # ----------------------------------------------
59+ - name : Safety scan
60+ env :
61+ API_KEY : ${{secrets.SAFETY_API_KEY}}
1462 run : |
15- echo "Safety check overridden - vulnerabilities 66742 and 77744 are addressed in pyproject.toml"
16- echo "black==24.3.0 and urllib3==2.5.0 resolve the security issues"
17- exit 0
63+ poetry run pip install safety
64+ poetry run safety --key "$API_KEY" --stage cicd scan
0 commit comments