Skip to content

Commit

Permalink
Merge pull request #57 from knorrium/knorrium/refactor_action
Browse files Browse the repository at this point in the history
Refactor GHA
  • Loading branch information
wiz authored May 10, 2024
2 parents e9dbb21 + 33480c0 commit 06c5a72
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/validate-json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,16 @@ jobs:
json_validator:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: json-syntax-check
uses: limitusus/json-syntax-check@v1
with:
pattern: "\\.json$"
- name: Checkout
uses: actions/checkout@v2

- name: Check for duplicates
run : |
sh dupes.sh
- name: Check JSON syntax
run: |
if ! jq empty pools-v2.json; then
echo "JSON syntax check failed"
exit 1
fi
9 changes: 9 additions & 0 deletions dupes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
OUTPUT=$(cat pools-v2.json | jq 'group_by(.id) | map(select(length>1) | .[])')

if [ "$OUTPUT" = "[]" ]; then
echo "no duplicate pool ids found"
exit 0
else
echo "duplicate pool ids found: $OUTPUT"
exit 1
fi

0 comments on commit 06c5a72

Please sign in to comment.