Skip to content

Commit

Permalink
fix: Fix GH Action for validating duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
suneshgovind committed Mar 17, 2024
1 parent 8bcf600 commit 3c25cb6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/github-actions-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ jobs:
run: |
git clone https://github.com/${{ github.repository }} -b `echo ${{ github.ref }} | cut -d'/' -f3`
cd tools.tldr.run/tools
echo "Total entries = " $(cat *.json | jq '.name' | sort | wc -l)
echo "Unique entries = " $(cat *.json | jq '.name' | sort | uniq -i | wc -l)
if [ $(cat *.json | jq '.name' | sort | uniq -i | wc -l) -ne $(cat *.json | jq '.name' | sort | wc -l) ]; echo "Duplicate entries list"; cat *.json | jq '.name' | sort | uniq -i -c -d; then exit 1; fi
UNIQUE_ENTRIES=($(cat *.json | jq '.name' | sort | uniq -i | wc -l))
TOTAL_ENTRIES=($(cat *.json | jq '.name' | sort | wc -l))
echo "Total entries = " "$TOTAL_ENTRIES"
echo "Unique entries = " "$UNIQUE_ENTRIES"
if [ "$UNIQUE_ENTRIES" -ne "$TOTAL_ENTRIES" ]; then
echo "Duplicate entries list"; cat *.json | jq '.name' | sort | uniq -i -c -d; exit 1;
else
echo "No Duplicate Entries";
fi
- name: List files in the repository
run: |
ls ${{ github.workspace }}
Expand Down

0 comments on commit 3c25cb6

Please sign in to comment.