Skip to content

Check if chains metadata is up to date #133

Check if chains metadata is up to date

Check if chains metadata is up to date #133

name: Check if chains metadata is up to date
on:
schedule:
- cron: '59 23 * * */7'
workflow_dispatch:
jobs:
check-chains-metadata:
permissions:
pull-requests: write
contents: write
name: Check if chains metadata is up to date
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
steps:
- name: Checkout Repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Install Dependencies
run: npm i
- name: Compare current chains metadata with the source
run: npm run compare-chains-metadata
- name: Check if new chains metadata file
id: compare_chains
run: |
set -x
if test -f "src/scripts/reference/chainsToBe.json"; then
cp "src/scripts/reference/chainsToBe.json" "src/scripts/reference/chains.json"
echo "createPR=true" >> $GITHUB_OUTPUT
timestamp=$(date +%Y%m%d%H%M)
echo "timestamp=${timestamp}" >> $GITHUB_OUTPUT
fi
- if: ${{ steps.compare_chains.outputs.createPR }}
id: chains_metadata_pr
name: Create pull request
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5
with:
branch: 'chains_metadata/pr-${{ steps.compare_chains.outputs.timestamp }}'
commit-message: 'chains metadata updated'
token: ${{ secrets.GITHUB_TOKEN }}
title: 'Update chains metadata ${{ steps.compare_chains.outputs.timestamp }}'
delete-branch: true
body: 'New chains metadata available. Please review and merge'
labels: |
enhancement
ready to merge