Skip to content

Commit 36f0d33

Browse files
committed
run automerge on tests complete
1 parent 3dc2d2b commit 36f0d33

1 file changed

Lines changed: 10 additions & 45 deletions

File tree

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Dependabot auto-merge
2-
on: pull_request
2+
on:
3+
workflow_run:
4+
workflows: ["Test AppSync utils"]
5+
types:
6+
- completed
37

48
permissions:
59
contents: write
@@ -16,59 +20,20 @@ jobs:
1620
with:
1721
github-token: "${{ secrets.GITHUB_TOKEN }}"
1822

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-
4923
- 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'
24+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
5425
run: gh pr merge --auto --squash "$PR_URL"
5526
env:
5627
PR_URL: ${{ github.event.pull_request.html_url }}
5728
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5829

5930
- 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'
31+
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
6432
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 }}
33+
gh pr comment "$PR_URL" --body "🚫 Auto-merge skipped: one or more test jobs failed.
7034
71-
Please review the failing checks and resolve any issues."
35+
Please review the failing checks and resolve any issues.
36+
"
7237
env:
7338
PR_URL: ${{ github.event.pull_request.html_url }}
7439
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)