55 types :
66 - opened
77 - synchronize
8+ - reopened
9+
10+ permissions :
11+ contents : write
12+ pull-requests : write
813
914jobs :
1015 auto-merge :
@@ -23,26 +28,64 @@ jobs:
2328 pull_number: context.issue.number
2429 });
2530
26- // Only auto -merge patch updates
31+ // Auto -merge patch and minor updates
2732 const title = pr.data.title.toLowerCase();
28- const isPatch = title.includes('patch') ||
29- title.match(/bump .+ from [\d]+\.[\d]+\.[\d]+ to [\d]+\.[\d]+\.[\d]+$/);
33+ const isMinorOrPatch = title.includes('patch') ||
34+ title.includes('minor') ||
35+ title.match(/bump .+ from [\d]+\.[\d]+\.[\d]+ to [\d]+\.[\d]+\.[\d]+$/);
36+
37+ console.log('PR Title:', title);
38+ console.log('Should merge:', isMinorOrPatch);
3039
31- return { shouldMerge: isPatch };
40+ return { shouldMerge: isMinorOrPatch };
3241
33- - name : Wait for checks
42+ - name : Auto-approve Dependabot PR
43+ if : fromJSON(steps.pr.outputs.result).shouldMerge
44+ run : |
45+ gh pr review ${{ github.event.pull_request.number }} --approve --body "Auto-approving dependency update"
46+ env :
47+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
48+
49+ - name : Wait for checks (with timeout)
3450 if : fromJSON(steps.pr.outputs.result).shouldMerge
3551 uses : fountainhead/action-wait-for-check@v1.2.0
3652 id : wait-for-checks
3753 with :
3854 token : ${{ secrets.GITHUB_TOKEN }}
3955 checkName : ' Tests (PHP 8.4)'
4056 ref : ${{ github.event.pull_request.head.sha }}
41- timeoutSeconds : 300
57+ timeoutSeconds : 600
58+ continue-on-error : true
4259
43- - name : Auto- merge
44- if : fromJSON(steps.pr.outputs.result).shouldMerge && steps.wait-for-checks.outputs.conclusion == 'success'
60+ - name : Check status and merge
61+ if : fromJSON(steps.pr.outputs.result).shouldMerge
4562 run : |
46- gh pr merge ${{ github.event.pull_request.number }} --squash --auto
63+ # Get current status
64+ STATUS=$(gh pr status ${{ github.event.pull_request.number }} --json statusCheckRollup --jq '.statusCheckRollup[] | select(.name == "Tests (PHP 8.4)") | .conclusion')
65+
66+ echo "Check status: $STATUS"
67+
68+ if [ "$STATUS" = "SUCCESS" ] || [ "$STATUS" = "NEUTRAL" ]; then
69+ echo "✅ Checks passed, merging PR"
70+ gh pr merge ${{ github.event.pull_request.number }} --squash --auto
71+ elif [ "$STATUS" = "FAILURE" ]; then
72+ echo "❌ Checks failed, not merging"
73+ exit 1
74+ else
75+ echo "⏳ Checks still running or unknown status, enabling auto-merge"
76+ gh pr merge ${{ github.event.pull_request.number }} --squash --auto
77+ fi
4778 env :
4879 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
80+
81+ - name : Comment on failure
82+ if : failure()
83+ uses : actions/github-script@v8
84+ with :
85+ script : |
86+ github.rest.issues.createComment({
87+ issue_number: context.issue.number,
88+ owner: context.repo.owner,
89+ repo: context.repo.repo,
90+ body: '🤖 Auto-merge failed. Please check the CI status and merge manually if appropriate.'
91+ });
0 commit comments