-
Notifications
You must be signed in to change notification settings - Fork 61
64 lines (55 loc) · 2.42 KB
/
workflow-merge-to-main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# This workflow is called when a pull request is approved
# that targets the protected branch `main`.
# The job `merge-to-main` ("Status check for enabling merging to main")
# is a required status check.
# (https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28)
# We can only merge to main when this job has run and is green.
# The workflow can be triggered manually, too.
name: Checks enabling merge to main
on:
pull_request_review:
types:
- submitted
branches:
- main
pull_request:
types:
- synchronize
branches:
- main
workflow_dispatch:
jobs:
checkout-code:
if: (github.event_name == 'pull_request' && github.event.action == 'synchronize') || (github.event_name == 'pull_request_review' && github.event.review.state == 'approved')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f #v4.1.3
with:
ref: ${{ github.ref }}
fetch-depth: 0
run-coral-jobs:
if: (github.event_name == 'pull_request' && github.event.action == 'synchronize') || (github.event_name == 'pull_request_review' && github.event.review.state == 'approved')
name: Run coral workflow before enabling merge to main
needs: checkout-code
uses: ./.github/workflows/jobs-coral.yaml
run-maven-jobs:
if: (github.event_name == 'pull_request' && github.event.action == 'synchronize') || (github.event_name == 'pull_request_review' && github.event.review.state == 'approved')
name: Run maven workflow before enabling merge to main
needs: checkout-code
uses: ./.github/workflows/jobs-maven.yaml
run-e2e-tests:
if: (github.event_name == 'pull_request' && github.event.action == 'synchronize') || (github.event_name == 'pull_request_review' && github.event.review.state == 'approved')
name: Run Playwright e2e test before enabling merge to main
needs: checkout-code
permissions:
actions: write
uses: ./.github/workflows/end-to-end-tests.yaml
merge-to-main:
name: Status check for enabling merging to main
if: (github.event_name == 'pull_request' && github.event.action == 'synchronize') || (github.event_name == 'pull_request_review' && github.event.review.state == 'approved')
runs-on: ubuntu-latest
needs: [ run-maven-jobs, run-coral-jobs, run-e2e-tests ]
steps:
- name: Confirm check
run: echo "🎉 this was successful"