diff --git a/.github/workflows/snyk.yml b/.github/workflows/snyk.yml index f9787c9..8b2aa07 100644 --- a/.github/workflows/snyk.yml +++ b/.github/workflows/snyk.yml @@ -41,26 +41,32 @@ jobs: id: determine_package shell: bash run: | - echo "${{ github.event.pull_request.changed_files }}" > changed_files.txt - curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github.v3+json" \ - "${{ github.event.pull_request.url }}/files" \ - > files.json - jq -r '.[].filename' files.json > changed_files.txt - cat changed_files.txt - package_path="" - skip=false - if grep -q "packages/auth0-acul-js/" changed_files.txt; then - package_path="packages/auth0-acul-js/package-lock.json" - elif grep -q "packages/ul-react/" changed_files.txt; then - package_path="packages/ul-react/package-lock.json" - elif grep -q "packages/ul-react-component/" changed_files.txt; then - package_path="packages/ul-react-component/package-lock.json" + if [ ${{ github.event.pull_request.changed_files }} -ne 0 ]; then + echo "${{ github.event.pull_request.changed_files }}" > changed_files.txt + curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + "${{ github.event.pull_request.url }}/files" \ + > files.json + jq -r '.[].filename' files.json > changed_files.txt + cat changed_files.txt + package_path="" + skip=false + if grep -q "packages/auth0-acul-js/" changed_files.txt; then + package_path="packages/auth0-acul-js/package-lock.json" + elif grep -q "packages/ul-react/" changed_files.txt; then + package_path="packages/ul-react/package-lock.json" + elif grep -q "packages/ul-react-component/" changed_files.txt; then + package_path="packages/ul-react-component/package-lock.json" + else + echo "No relevant changes detected." + echo "skip=true" >> $GITHUB_OUTPUT + fi + echo "package_path=$package_path" >> $GITHUB_OUTPUT else - echo "No relevant changes detected." - echo "skip=true" >> $GITHUB_OUTPUT + echo "No relevant changes found." + echo "skip=true" >> $GITHUB_OUTPUT fi - echo "package_path=$package_path" >> $GITHUB_OUTPUT + - name: Skip if no relevant changes if: steps.determine_package.outputs.skip == 'true'