Merge pull request #57 from knorrium/knorrium/refactor_action

Refactor GHA
This commit is contained in:
wiz 2024-05-11 01:51:17 +09:00 committed by GitHub
commit 06c5a72059
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 5 deletions

View File

@ -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
dupes.sh Executable file
View File

@ -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