Sync Fork with Upstream #45
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
name: Sync Fork with Upstream | |
on: | |
schedule: | |
- cron: "30 23 * * *" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Git user | |
run: | | |
git config --global user.name "Arne Tarara - Automated" | |
git config --global user.email "arne@green-coding.io" | |
- name: Add remote repository | |
run: | | |
git remote add upstream https://github.com/wagtail/bakerydemo | |
git fetch upstream | |
- name: Check for updates | |
run: | | |
CHANGES=$(git rev-list HEAD..upstream/main --count) | |
if [ "$CHANGES" -gt 0 ]; then | |
echo "Updating fork main branch..." | |
git checkout main | |
git merge upstream/main | |
git push | |
echo "Updating fork gmt-pinned-versions branch..." | |
git checkout gmt-pinned-versions | |
git merge upstream/main | |
git push | |
else | |
echo "No updates from the original repository." | |
fi | |