-
Notifications
You must be signed in to change notification settings - Fork 31
46 lines (38 loc) 路 1.2 KB
/
Copy pathsync-content.yml
File metadata and controls
46 lines (38 loc) 路 1.2 KB
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
name: Sync Content from Upstream
on:
schedule:
- cron: "0 0,6,12,18 * * *"
workflow_dispatch:
permissions:
contents: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Run sync script
run: bun run scripts/sync-upstream.ts
- name: Check for changes
id: changes
run: |
if [[ -n $(git status --porcelain content/) ]]; then
echo "has_changes=true" >> $GITHUB_OUTPUT
else
echo "has_changes=false" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.changes.outputs.has_changes == 'true'
run: |
COMMIT_SHA=$(cat .upstream-commit 2>/dev/null || echo "unknown")
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add content/
git commit -m "chore: sync content from upstream (${COMMIT_SHA:0:7})"
git push