Skip to content

Commit 5c4c828

Browse files
committed
feat: add sync workflow for prod branch with daily schedule
1 parent 82e5d6d commit 5c4c828

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

.github/workflows/sync-prod.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Sync Prod Branch
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *" # Daily at midnight UTC
6+
workflow_dispatch: # Manual trigger
7+
8+
jobs:
9+
sync:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
token: ${{ secrets.GITHUB_TOKEN }}
17+
18+
- name: Configure Git
19+
run: |
20+
git config user.name "github-actions[bot]"
21+
git config user.email "github-actions[bot]@users.noreply.github.com"
22+
23+
- name: Fetch upstream
24+
run: git fetch upstream
25+
26+
- name: Reset prod to upstream/dev
27+
run: |
28+
git checkout prod
29+
git reset --hard upstream/dev
30+
31+
- name: Push prod
32+
run: |
33+
SKIP_HUSKY=1 git push origin prod --force
34+
env:
35+
SKIP_HUSKY: 1

.husky/pre-push

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#!/bin/sh
2+
# Skip husky for sync or prod branch
3+
if [ "$SKIP_HUSKY" = "1" ] || [ "$(git rev-parse --abbrev-ref HEAD)" = "prod" ]; then
4+
exit 0
5+
fi
26
# Check if bun version matches package.json
37
EXPECTED_VERSION=$(grep '"packageManager"' package.json | sed 's/.*"bun@\([^"]*\)".*/\1/')
48
CURRENT_VERSION=$(bun --version)

0 commit comments

Comments
 (0)