Skip to content

Commit ddb1cb0

Browse files
Update main.yml
1 parent defd804 commit ddb1cb0

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

.github/workflows/main.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
name: Merge Master into AAA_ForSesame and Push
1+
name: Merge ApsimX Master into AAA_ForSesame and Push
22

33
on:
4-
push:
5-
branches:
6-
- master
4+
schedule:
5+
- cron: '0 */4 * * *' # Run every 4 hours (adjust as needed)
76

87
jobs:
98
merge_and_push:
@@ -22,14 +21,28 @@ jobs:
2221
ref: AAA_ForSesame
2322
path: ApsimNG
2423

25-
- name: Merge Master into AAA_ForSesame
24+
- name: Check for changes in ApsimX master
25+
id: check_changes
26+
run: |
27+
cd ApsimNG
28+
git remote add apsimx https://github.com/APSIMInitiative/ApsimX.git
29+
git fetch apsimx master
30+
if [ $(git rev-list --count apsimx/master..AAA_ForSesame) -gt 0 ]; then
31+
echo "changes_exist=true" >> $GITHUB_OUTPUT
32+
else
33+
echo "changes_exist=false" >> $GITHUB_OUTPUT
34+
fi
35+
36+
- name: Merge Master into AAA_ForSesame (if changes exist)
37+
if: steps.check_changes.outputs.changes_exist == 'true'
2638
run: |
2739
cd ApsimNG
2840
git config --global user.name 'GitHub Action'
2941
git config --global user.email 'action@github.com'
3042
git merge origin/master
3143
32-
- name: Push AAA_ForSesame to ApsimNG
44+
- name: Push AAA_ForSesame to ApsimNG (if changes exist)
45+
if: steps.check_changes.outputs.changes_exist == 'true'
3346
run: |
3447
cd ApsimNG
3548
git push

0 commit comments

Comments
 (0)