Skip to content

Sync from Source Repo #208

Sync from Source Repo

Sync from Source Repo #208

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