Skip to content

Commit

Permalink
Update jscpd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
patmmccann authored Jun 9, 2024
1 parent 77987bf commit dd09288
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/jscpd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,25 @@ jobs:
echo "Filtering jscpd report for changed files..."
CHANGED_FILES=$(jq -R -s -c 'split("\n")[:-1]' changed_files.txt)
echo "Changed files: $CHANGED_FILES"
jq --argjson changed_files "$CHANGED_FILES" '.duplicates | map(select($changed_files | index(.firstFile) or $changed_files | index(.secondFile)))' ./jscpd-report.json > filtered-jscpd-report.json
jq --argjson changed_files "$CHANGED_FILES" '
.duplicates | map(select(
($changed_files | index(.firstFile.name)) or
($changed_files | index(.secondFile.name))
))
' ./jscpd-report.json > filtered-jscpd-report.json
cat filtered-jscpd-report.json
- name: Check if filtered jscpd report exists
id: check_filtered_report
run: |
if [ -f ./filtered-jscpd-report.json ]; then
echo "filtered_report_exists=true" >> $GITHUB_ENV
else
echo "filtered_report_exists=false" >> $GITHUB_ENV
fi
- name: Upload filtered jscpd report
if: always()
if: env.filtered_report_exists == 'true'
uses: actions/upload-artifact@v4
with:
name: filtered-jscpd-report
Expand Down

0 comments on commit dd09288

Please sign in to comment.