Skip to content

Swiss Staking AG gentx #66

Swiss Staking AG gentx

Swiss Staking AG gentx #66

name: Validate Gentx
on:
# Using pull_request_target to allow forks to write comments and update the
# csv file that is tracking the authors.
# This is OK because of the branch protections we have on the repo so forks
# can't change anything without their PR being approved.
#
# NOTE: This means we should be careful when extending this specific workflow
# file.
pull_request_target:
jobs:
find-gentx-files:
runs-on: ubuntu-latest
outputs:
gentx-files: ${{ steps.set-outputs.outputs.gentx-files }}
gentx-changed: ${{ steps.set-outputs.outputs.gentx-changed }}
steps:
- uses: actions/checkout@v4
- 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"
echo "gentx-changed=${{ steps.changed-files.outputs.any_changed }}" >> "$GITHUB_OUTPUT"
jq-format:
needs: find-gentx-files
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: List all changed files
run: |
for file in ${{ needs.find-gentx-files.outputs.gentx-files }}; do
jq . $file >$file"_tmp"
cmp -s $file"_tmp" $file || (echo "$file gentx file not formatted" && exit 1)
done
- name: Add comment about formatting failure
if: failure()
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Please format your gentx by running `jq . path/to/gentx.json > path/to/gentx.json_tmp && mv path/to/gentx.json_tmp path/to/gentx.json` and resubmit the PR.'
})
valid-gentx:
needs: find-gentx-files
runs-on: ubuntu-latest
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