Check if chains metadata is up to date #91
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: 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@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 | |
- 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 ".scripts/reference/chainsToBe.json"; then | |
cp ".scripts/reference/chainsToBe.json" ".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@2b011faafdcbc9ceb11414d64d0573f37c774b04 # v4.2.0 | |
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 |