Skip to content

Commit

Permalink
Merge Commits : Failing Snyk Scan (#13)
Browse files Browse the repository at this point in the history
* Unit Test and Snyk Test Check

* Added Curl Logic For Merge Commits

* Echoing out difference files

* Printing compare.json

* Changing the logic for merge commits

* Updating if condition

* Changing else condition echo statement

* Changing conditional logic

* Braces changed

* Reverting Head and Base Comparison Changes

* Reverting Testing Changes
  • Loading branch information
kishore7snehil authored Dec 10, 2024
1 parent c3f128c commit 491ac17
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 491ac17

Please sign in to comment.