-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (40 loc) · 1.24 KB
/
snyk_scan.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Snyk Security Scan
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions: write-all
jobs:
snyk_scan:
name: Snyk Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.MY_GH_TOKEN }} # Aquí usamos el PAT en lugar del GITHUB_TOKEN
- name: Install Snyk CLI
run: npm install -g snyk
- name: Run Snyk security scan
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: |
set +e
snyk monitor --all-projects --org=6ce58cdd-2e65-4c0c-bbe5-705980cee5fe
snyk test --all-projects --org=6ce58cdd-2e65-4c0c-bbe5-705980cee5fe
TEST_RESULT=$?
set -e
echo Prueba despues del test
echo "$TEST_RESULT"
if [ $TEST_RESULT == 0 ]; then
echo "No vulnerabilities found."
else
echo "Vulnerabilities found. Reverting to previous version..."
git config --global user.email "[email protected]"
git config --global user.name "rodrigo3829l"
git reset --hard HEAD^
git push https://github.com/rodrigo3829l/db_api_mygarden_llc.git --force
fi