Sync from Source Repo #206
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 from Source Repo | |
| on: | |
| schedule: | |
| - cron: '0 */6 * * *' # Every 6 hours | |
| workflow_dispatch: # Manual trigger | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout this repo | |
| uses: actions/checkout@v4 | |
| - name: Fetch from source repo | |
| run: | | |
| git clone --depth 1 --filter=blob:none --sparse \ | |
| https://github.com/LFDT-Nightstream/Nightstream.git \ | |
| source-repo | |
| cd source-repo | |
| git sparse-checkout set demos/wasm-demo | |
| - name: Sync files | |
| run: | | |
| # Remove old files (except .git and .github) | |
| find . -mindepth 1 -maxdepth 1 ! -name '.git' ! -name '.github' ! -name 'source-repo' -exec rm -rf {} + | |
| # Copy new files | |
| cp -r source-repo/demos/wasm-demo/* ./ | |
| rm -rf source-repo | |
| - name: Commit and push | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add -A | |
| if git diff --staged --quiet; then | |
| echo "No changes to sync" | |
| else | |
| git commit -m "Sync from source repo $(date -u +%Y-%m-%d)" | |
| git push | |
| fi |