forked from wagtail/bakerydemo
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (38 loc) · 1.12 KB
/
sync_upstream.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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 "[email protected]"
- 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