Sync Content from Upstream #398
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |