Skip to content

Sync RPC list with Chainlist #500

Sync RPC list with Chainlist

Sync RPC list with Chainlist #500

name: Sync RPC list with Chainlist
on:
schedule:
- cron: '0 0 * * *'
push:
branches:
- main
paths:
- ".github/workflows/sync-with-chainlist.yml"
- "modules/**"
- "app.js"
- "tests/**"
jobs:
build:
name: Sync with Chainlist repository
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
# Set up node and install frontend dependencies
- name: Set up Node.js (.nvmrc)
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Generate list
run: npm run import
- name: Check for any changes and exit if none
run: |
if git diff --quiet; then
echo "No changes detected. Exiting gracefully."
echo "CHANGES_DETECTED=false" >> $GITHUB_ENV
else
echo "Changes detected. Continuing with the workflow."
echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
fi
- name: Run tests to make sure everything is coherent
if: env.CHANGES_DETECTED == 'true'
run: npm test
- name: Install SSH Key
if: env.CHANGES_DETECTED == 'true'
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
- name: Push updated patch commit
if: env.CHANGES_DETECTED == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_NAME: ${{ github.repository }}
USERNAME: ${{ github.repository_owner }}
run: |
git checkout main
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
npm version patch -f -m "🤖 Import updated chainlist rpcs, bump version to %s"
git add constants/*
git commit -m "🤖 Import updated chainlist rpcs"
git push