Skip to content

Commit a280b7b

Browse files
committed
only merge if tests pass
1 parent e701679 commit a280b7b

File tree

1 file changed

+54
-2
lines changed

1 file changed

+54
-2
lines changed

.github/workflows/dependabot-automerge.yml

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,60 @@ jobs:
1515
uses: dependabot/fetch-metadata@v1
1616
with:
1717
github-token: "${{ secrets.GITHUB_TOKEN }}"
18+
19+
- name: Wait for tests to pass
20+
uses: fountainhead/action-wait-for-check@v1.2.0
21+
id: wait-for-tests
22+
with:
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
checkName: unit-test
25+
ref: ${{ github.event.pull_request.head.sha }}
26+
timeoutSeconds: 600
27+
intervalSeconds: 30
28+
29+
- name: Wait for integration tests to pass
30+
uses: fountainhead/action-wait-for-check@v1.2.0
31+
id: wait-for-integration
32+
with:
33+
token: ${{ secrets.GITHUB_TOKEN }}
34+
checkName: integration-test
35+
ref: ${{ github.event.pull_request.head.sha }}
36+
timeoutSeconds: 600
37+
intervalSeconds: 30
38+
39+
- name: Wait for LocalStack tests to pass
40+
uses: fountainhead/action-wait-for-check@v1.2.0
41+
id: wait-for-localstack
42+
with:
43+
token: ${{ secrets.GITHUB_TOKEN }}
44+
checkName: localstack-test
45+
ref: ${{ github.event.pull_request.head.sha }}
46+
timeoutSeconds: 600
47+
intervalSeconds: 30
48+
1849
- name: Enable auto-merge for Dependabot PRs
50+
if: |
51+
steps.wait-for-tests.outputs.conclusion == 'success' &&
52+
steps.wait-for-integration.outputs.conclusion == 'success' &&
53+
steps.wait-for-localstack.outputs.conclusion == 'success'
1954
run: gh pr merge --auto --squash "$PR_URL"
2055
env:
21-
PR_URL: ${{github.event.pull_request.html_url}}
22-
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
56+
PR_URL: ${{ github.event.pull_request.html_url }}
57+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: Comment on PR if tests failed
60+
if: |
61+
steps.wait-for-tests.outputs.conclusion != 'success' ||
62+
steps.wait-for-integration.outputs.conclusion != 'success' ||
63+
steps.wait-for-localstack.outputs.conclusion != 'success'
64+
run: |
65+
gh pr comment "$PR_URL" --body "🚫 Auto-merge skipped: one or more test jobs failed or timed out.
66+
67+
- unit-test: ${{ steps.wait-for-tests.outputs.conclusion }}
68+
- integration-test: ${{ steps.wait-for-integration.outputs.conclusion }}
69+
- localstack-test: ${{ steps.wait-for-localstack.outputs.conclusion }}
70+
71+
Please review the failing checks and resolve any issues."
72+
env:
73+
PR_URL: ${{ github.event.pull_request.html_url }}
74+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)