Update Demo #346
This file contains 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
# Automatically pull changes to the demo site from the main 'esbonio' repo. | |
name: 'Update Demo' | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/update-demo.yml' | |
workflow_dispatch: | |
schedule: | |
- cron: '33 10 * * *' | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'swyddfa/esbonio' | |
ref: 'develop' | |
path: 'esbonio' | |
- uses: actions/checkout@v4 | |
with: | |
path: 'demo' | |
- run: | | |
set -eux | |
rsync -av --delete \ | |
--exclude=.git* \ | |
--exclude=requirements.* \ | |
--exclude=.readthedocs.yaml \ | |
esbonio/lib/esbonio/tests/workspaces/demo/ demo | |
cd demo | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config user.name "github-actions[bot]" | |
git checkout -b "sync-$(date +%Y-%d-%m)" | |
git add . | |
(git commit -am "Sync demo content" && echo "changes=yes" >> $GITHUB_OUTPUT) || echo "changes=no" >> $GITHUB_OUTPUT | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
git log -1 --stat >> $GITHUB_STEP_SUMMARY | |
echo '' >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
id: sync | |
name: Sync content | |
- run: | | |
set -eux | |
cd demo | |
git push -u origin "sync-$(date +%Y-%d-%m)" | |
gh pr create --base main --fill | |
name: Open PR | |
if: steps.sync.outputs.changes == 'yes' && github.event_name != 'pull_request' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |