File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 15
15
env :
16
16
# Declare to satisfy linter, will be set dynamically during workflow execution
17
17
PR_NUMBER : " "
18
+ HAS_NEW_COMMITS : " "
18
19
19
20
steps :
20
21
- name : Checkout repository
@@ -27,15 +28,22 @@ jobs:
27
28
git config user.name 'github-actions[bot]'
28
29
git config user.email 'github-actions[bot]@users.noreply.github.com'
29
30
31
+ - name : Check for new commits
32
+ shell : pwsh
33
+ run : |
34
+ # Check if there are commits between rel/weekly and main
35
+ $commitCount = git rev-list --count rel/weekly..main
36
+ echo "HAS_NEW_COMMITS=$($commitCount -gt 0)" >> $env:GITHUB_ENV
37
+
30
38
- name : Create weekly release PR
39
+ if : ${{ env.HAS_NEW_COMMITS == 'true' }}
31
40
shell : pwsh
32
41
run : |
33
42
# Create PR from main to rel/weekly, capture created URL
34
43
$PR_URL = $(gh pr create `
35
44
--base rel/weekly `
36
45
--head main `
37
46
--title "Scheduled weekly release $(Get-Date -Format 'yyyy-MM-dd')" `
38
- --body "Automated weekly release PR created by scheduled workflow." `
39
47
--fill-verbose `
40
48
--reviewer michael-hawker)
41
49
46
54
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
47
55
48
56
- name : Enable auto-merge for the PR
57
+ if : ${{ env.HAS_NEW_COMMITS == 'true' }}
49
58
shell : pwsh
50
59
run : |
51
60
gh pr merge ${{ env.PR_NUMBER }} --auto --rebase
You can’t perform that action at this time.
0 commit comments