You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+60
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,66 @@ jobs:
24
24
25
25
Alternatively, you can run on other event types such as `on: [push]`. In that case the action will lint the push event's commit(s) instead of linting commits from a pull request. You can also combine `push` and `pull_request` together in the same workflow.
26
26
27
+
### Using with GitHub Merge Queues
28
+
29
+
GitHub's [merge queue](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue) is a feature that allows you to queue pull requests for merging once they meet certain criteria. When using merge queues, you need to ensure that your workflows are set up to handle the merge_group event, which is triggered when pull requests are added to the merge queue.
30
+
31
+
#### Workflow Configuration
32
+
33
+
To use the commitlint-github-action with merge queues, you need to set up a workflow that listens to the merge_group event. Here's an example of how to configure your workflow:
34
+
35
+
```yaml
36
+
name: Lint Commit Messages in Merge Queue
37
+
38
+
on:
39
+
merge_group:
40
+
types:
41
+
- checks_requested
42
+
43
+
jobs:
44
+
commitlint:
45
+
runs-on: ubuntu-latest
46
+
steps:
47
+
- uses: actions/checkout@v3
48
+
with:
49
+
ref: ${{ github.sha }}
50
+
51
+
- uses: wagoid/commitlint-github-action@v6
52
+
```
53
+
54
+
#### Important Note:
55
+
56
+
To ensure that the merge_group event triggers correctly, you need to have **at least one workflow that responds to the pull_request event** with a job named the same as the one in your merge_group workflow (**commitlint** in this example). This is necessary because the merge queue relies on the existence of status checks from the pull request context.
57
+
58
+
Here's a minimal pull_request workflow to satisfy this requirement:
59
+
60
+
```yaml
61
+
name: Placeholder Workflow for Merge Queue
62
+
63
+
on:
64
+
pull_request:
65
+
66
+
jobs:
67
+
commitlint:
68
+
runs-on: ubuntu-latest
69
+
steps:
70
+
- name: Checkout Repository
71
+
uses: actions/checkout@v3
72
+
```
73
+
74
+
This workflow can also be a meaningful one that checks out the commits in your PR and runs other checks, but it must have a job named **commitlint**.
75
+
76
+
### Enabling Merge Queues in Your Repository
77
+
78
+
Before you can use merge queues, you need to enable the feature in your repository settings:
79
+
80
+
- Go to your repository's Settings > Branches.
81
+
- Under Branch protection rules, edit the rule for your target branch (e.g. master).
82
+
- Enable Require merge queue.
83
+
- Specify your new job (e.g. commitlint) and any other required status checks, that must pass before merging.
84
+
85
+
For more information on configuring merge queues, refer to the [GitHub documentation on managing a merge queue](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue).
86
+
27
87
## Inputs
28
88
29
89
You can supply these inputs to the `wagoid/commitlint-github-action@v6` step.
0 commit comments