forked from celestiaorg/networks
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (60 loc) · 1.86 KB
/
validate-gentx.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Validate Gentx
on:
pull_request:
jobs:
find-gentx-files:
runs-on: ubuntu-latest
outputs:
gentx-files: ${{ steps.set-outputs.outputs.gentx-files }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed gentx files
id: changed-files
uses: tj-actions/changed-files@v39
with:
files: "./celestia/*gentx*/*.json"
- name: Set outputs
id: set-outputs
run: |
echo "gentx-files=${{ steps.changed-files.outputs.all_changed_files }}" >> "$GITHUB_OUTPUT"
jq-format:
needs: find-gentx-files
runs-on: ubuntu-latest
if: ${{ needs.find-gentx-files.outputs.gentx-files != '' }}
steps:
- uses: actions/checkout@v4
- name: Check gentx files against jq
run: |
for file in ${{ needs.find-gentx-files.outputs.gentx-files }}; do
formatted=$(jq . $file)
if [ "$formatted" != "$(cat $file)" ]; then
echo "$file gentx file not formatted"
echo "expected:"
echo "$formatted"
echo "found:"
cat $file
echo ""
echo "Hexdump of file:"
head -c 100 "$file" | hexdump -C
echo "Hexdump of jq output:"
echo "$formatted" | head -c 100 | hexdump -C
exit 1
fi
done
valid-gentx:
needs: find-gentx-files
runs-on: ubuntu-latest
if: ${{ needs.find-gentx-files.outputs.gentx-files != '' }}
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.21
- name: Validate addresses and a balances
run: |
for file in ${{ needs.find-gentx-files.outputs.gentx-files }}; do
go run .github/workflows/validate.go $file
done