Sync on chain Token List #630
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: Sync on chain Token List | |
on: | |
# This job is scheduled to run: | |
schedule: | |
- cron: '0 12 * * *' # Every day at 12:00 | |
jobs: | |
build: | |
if: github.repository == 'Consensys/linea-token-list' | |
runs-on: ubuntu-latest | |
env: | |
PROVIDER_URL: ${{ secrets.PROVIDER_URL }} | |
LINEA_PROVIDER_URL: ${{ secrets.LINEA_PROVIDER_URL }} | |
CONTRACT_ADDRESS: ${{ secrets.CONTRACT_ADDRESS }} | |
L2_TOKEN_BRIDGE: ${{ secrets.L2_TOKEN_BRIDGE }} | |
HAS_CHANGES: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Install dependencies | |
run: npm install | |
- name: Execute syncMainnetFulllist | |
run: npm run start | |
- name: Check for changes | |
run: | | |
if [[ -n $(git diff --exit-code) ]]; then | |
echo "Changes detected. Creating a Pull Request." | |
echo "HAS_CHANGES=true" >> $GITHUB_ENV | |
else | |
echo "No changes detected. Skipping pull request creation." | |
exit 0 | |
fi | |
- name: Create Pull Request | |
id: create-pr | |
if: env.HAS_CHANGES == 'true' | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
committer: GitHub <noreply@github.com> | |
delete-branch: true | |
title: 'Update linea-mainnet-token-fulllist.json' | |
branch: token-automatic-list | |
base: main | |
- name: Pull Request Automerge | |
if: env.HAS_CHANGES == 'true' | |
uses: peter-evans/enable-pull-request-automerge@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
pull-request-number: ${{ steps.create-pr.outputs.pull-request-number }} | |
merge-method: squash |