-
Notifications
You must be signed in to change notification settings - Fork 406
58 lines (50 loc) · 1.89 KB
/
sync-chains.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Sync chains every hour
on:
# temporarily disabled chain syncing
# 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@v4
- 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 "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
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@v6
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"