Correcciones api #179
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 }} | |
- 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 | |
# en esta variable guarda el resultado de la prueba puede ser 1 o 0 | |
TEST_RESULT=$? | |
set -e | |
echo Prueba despues del test | |
echo "$TEST_RESULT" | |
# si el resultado es igual a 0 | |
if [ $TEST_RESULT == 0 ]; then | |
# solo imprime que no hay vulnerabilidades | |
echo "No vulnerabilities found." | |
else | |
# imprime que hay vulnerabilidades | |
echo "Vulnerabilities found. Reverting to previous version..." | |
git config --global user.email "[email protected]" | |
git config --global user.name "rodrigo3829l" | |
# aqui regresa el commit | |
git reset --hard HEAD^ | |
git push https://github.com/rodrigo3829l/db_api_mygarden_llc.git --force | |
fi |