58 lines
1.8 KiB
YAML
58 lines
1.8 KiB
YAML
name: Sync chains every hour
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 * * * *" # Runs every hour
|
|
workflow_dispatch: # Allows you to manually run the workflow from the Actions tab
|
|
|
|
jobs:
|
|
sync-chains:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install bun
|
|
uses: oven-sh/setup-bun@v1
|
|
with:
|
|
bun-version: 1.0.35
|
|
|
|
- name: Run chains sync
|
|
run: bun run db:sync
|
|
working-directory: ./legacy_packages/chains
|
|
|
|
- name: Check for Changes
|
|
id: git-check
|
|
run: |
|
|
if git diff --quiet; then
|
|
echo "CHANGES_FOUND=false" >> $GITHUB_ENV
|
|
else
|
|
echo "CHANGES_FOUND=true" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Create or Update sync-chains.md
|
|
if: env.CHANGES_FOUND == 'true'
|
|
run: |
|
|
echo '---' > .changeset/sync-chains.md
|
|
echo '"@thirdweb-dev/chains": patch' >> .changeset/sync-chains.md
|
|
echo '---' >> .changeset/sync-chains.md
|
|
echo '' >> .changeset/sync-chains.md
|
|
echo 'Synced Chains Package' >> .changeset/sync-chains.md
|
|
|
|
- name: Commit Changes
|
|
if: env.CHANGES_FOUND == 'true'
|
|
run: |
|
|
git config --local user.email "[email protected]"
|
|
git config --local user.name "GitHub Action"
|
|
git add -A
|
|
git commit -m "chore(chains): sync from db"
|
|
|
|
- name: Create or Update Pull Request
|
|
if: env.CHANGES_FOUND == 'true'
|
|
uses: peter-evans/create-pull-request@v3
|
|
with:
|
|
title: "chore(chains): update chains"
|
|
branch: "sync-chains"
|
|
body: "This PR was automatically created by a GitHub Action. It updates the chains package with the latest changes from the database."
|
|
commit-message: "chore(chains): sync from db"
|