Skip to content

Commit 5262e0f

Browse files
ci: Make the auto-merge check for all CI jobs
Instead of only the auto-merge job
1 parent bb8b554 commit 5262e0f

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

.github/workflows/auto-merge.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Auto Merge PRs from Specific User
1+
name: Auto Merge PRs from github-actions[bot]
22

33
on:
44
pull_request:
@@ -9,14 +9,32 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
if: github.event.pull_request.user.login == 'github-actions[bot]'
12-
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v4
1512

16-
- name: Wait for CI checks to complete
17-
uses: ahmadnassri/action-workflow-run-wait@v1
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
statuses: read
17+
18+
steps:
19+
- name: Wait for all required status checks
20+
run: |
21+
echo "Waiting for all required status checks to pass..."
22+
for i in {1..60}; do
23+
STATUS=$(gh api repos/${{ github.repository }}/commits/${{ github.event.pull_request.head.sha }}/status --jq '.state')
24+
echo "Current status: $STATUS"
25+
if [[ "$STATUS" == "success" ]]; then
26+
echo "All checks passed!"
27+
break
28+
elif [[ "$STATUS" == "failure" ]]; then
29+
echo "Some checks failed. Exiting."
30+
exit 1
31+
fi
32+
sleep 10
33+
done
34+
env:
35+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1836

19-
- name: Merge PR via GitHub CLI
20-
run: gh pr merge ${{ github.event.pull_request.number }} --merge --admin
37+
- name: Merge PR using gh CLI
38+
run: gh pr merge ${{ github.event.pull_request.html_url }} --merge --admin --delete-branch
2139
env:
2240
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)