Snyk Security Scan #104
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: 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 |