Update Known Good Block Numbers #41
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: | |
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: setup node env | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: 'yarn' | |
- run: yarn --immutable | |
- 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 | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: KNOWN_GOOD_BLOCK_NUMBERS.env | |
path: KNOWN_GOOD_BLOCK_NUMBERS.env | |
retention-days: 1 | |
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 | |
- name: Download a single artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: KNOWN_GOOD_BLOCK_NUMBERS.env | |
- run: yarn test packages/${{ matrix.tests }} | |
save: | |
needs: tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download a single artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: KNOWN_GOOD_BLOCK_NUMBERS.env | |
- name: Commit and push changes | |
run: | | |
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 |