Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 30 additions & 11 deletions .github/workflows/update-chains.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,37 @@ jobs:
- name: Install ts-node
run: pnpm add -g ts-node

- name: Set up git
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Action"

- name: Generate timestamp and readable date
run: |
echo "TIMESTAMP=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
echo "READABLE_DATE=$(date +'%B %-d')" >> $GITHUB_ENV

- name: Fetch latest dev and create new branch
run: |
git fetch origin dev
git checkout -b "automated-update-${{ env.TIMESTAMP }}" origin/dev

- name: Update chains data
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/update-chains.ts

- name: Commit and push
run: |
git add -A
git commit -m "Update chains data"
git push origin "automated-update-${{ env.TIMESTAMP }}"

- name: Create PR body
run: |
echo "Automated update of chains data from https://chainid.network/chains.json" > pr_body.txt
echo "" >> pr_body.txt
echo "This workflow runs every Friday at 16:20 (UTC)." >> pr_body.txt

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update-chains
branch-suffix: timestamp
commit-message: |
Update chains data
base: dev
title: Update chains data
body: Automated update of chains data from https://chainid.network/chains.json
labels: update 🔄
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
gh pr create --base dev --head "automated-update-${{ env.TIMESTAMP }}" --title "Update chains data - ${{ env.READABLE_DATE }}" --body-file pr_body.txt --label "update 🔄"