Update Known Good Block Numbers #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Known Good Block Numbers | |
on: | |
workflow_dispatch: | |
# schedule: | |
# - cron: '0 */6 * * *' | |
env: | |
DB_PATH: ./db.sqlite | |
GH_TOKEN: ${{ github.token }} | |
permissions: | |
contents: write # required for push commit | |
pull-requests: write # required for create pr | |
jobs: | |
define-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
tests: ${{ steps.tests.outputs.tests }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Define Tests | |
id: tests | |
run: | | |
echo tests=$(cd packages && ls */src/*.test.ts | jq -R -s -c 'split("\n")[:-1]') >> "$GITHUB_OUTPUT" | |
- name: Update Known Good Block Numbers | |
run: | | |
yarn update-known-good | |
cat KNOWN_GOOD_BLOCK_NUMBERS.env >> $GITHUB_ENV | |
tests: | |
needs: define-matrix | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
tests: ${{ fromJSON(needs.define-matrix.outputs.tests) }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup node env | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: 'yarn' | |
- run: yarn --immutable | |
- run: echo $ACALA_BLOCK_NUMBER | |
- run: yarn test packages/${{ matrix.tests }} | |
save: | |
needs: tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Commit and push changes | |
run: | | |
export | grep BLOCK_NUMBER > KNOWN_GOOD_BLOCK_NUMBERS.env | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
git add KNOWN_GOOD_BLOCK_NUMBERS.env | |
if ! git diff --cached --quiet; then | |
git commit -m "[CI Skip] Update KNOWN_GOOD_BLOCK_NUMBERS" | |
git push | |
else | |
echo "No changes to commit" | |
fi |