Skip to content

Commit f75f66c

Browse files
wahtiquefkirc
andauthored
feat: do not skip merge group (#329)
* feat: do not skip merge gorup - add `merge_group` as workflow trigger - add `merge_group` to default value sfor `do-not-skip` triggers : else, worfklow will be skipped when the PR is added to a merge queue since it just ran before * chore: compile --------- Co-authored-by: Felix K <[email protected]>
1 parent c925fb1 commit f75f66c

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

README.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ If true, skip if an already finished duplicate run can be found.
135135

136136
A JSON-array with triggers that should never be skipped.
137137

138-
Possible values are `pull_request`, `push`, `workflow_dispatch`, `schedule`, `release`.
138+
Possible values are `pull_request`, `push`, `workflow_dispatch`, `schedule`, `release`, `merge_group`.
139139

140-
**Default:** `'["workflow_dispatch", "schedule"]'`
140+
**Default:** `'["workflow_dispatch", "schedule", "merge_group"]'`
141141

142142
### `concurrent_skipping`
143143

@@ -235,6 +235,7 @@ To minimize changes to existing jobs, it is often easier to skip entire jobs.
235235
>
236236
> - You may need to use [`fromJSON`](https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson) to access properties of object outputs. For example, for `skipped_by.id`, you can use the expression: `${{ fromJSON(steps.skip_check.outputs.skipped_by).id }}`.
237237
> - For GitHub repositories where [default permissions](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#setting-the-permissions-of-the-github_token-for-your-repository) for `GITHUB_TOKEN` has been set to "permissive (read-only)", the following lines must be included in the workflow (see [permissions syntax](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions)):
238+
>
238239
> ```yaml
239240
> # Minimum permissions required by skip-duplicate-actions
240241
> permissions:
@@ -408,14 +409,15 @@ stateDiagram-v2
408409

409410
### How to Use Skip Check With Required Matrix Jobs?
410411

411-
Discussed in https://github.com/fkirc/skip-duplicate-actions/issues/44.
412+
Discussed in <https://github.com/fkirc/skip-duplicate-actions/issues/44>.
412413

413414
If you have matrix jobs that are registered as required status checks and the matrix runs conditionally based on the skip check, you might run into the problem that the pull request remains in a unmergable state forever because the jobs are not executed at all and thus not reported as skipped (`Expected - Waiting for status to be reported`).
414415

415416
There are several approaches to circumvent this problem:
416417

417-
- Define the condition (`if`) in each step in the matrix job instead of a single condition on the job level: https://github.com/fkirc/skip-duplicate-actions/issues/44
418+
- Define the condition (`if`) in each step in the matrix job instead of a single condition on the job level: <https://github.com/fkirc/skip-duplicate-actions/issues/44>
418419
- If you want the check to be considered successful only if all jobs in the matrix were successful, you can add a subsequent job whose only task is to report the final status of the matrix. Then you can register this final job as a required status check:
420+
419421
```yaml
420422
result:
421423
name: Result
@@ -429,6 +431,7 @@ There are several approaches to circumvent this problem:
429431
if: needs.example-matrix-job.result != 'success'
430432
run: exit 1
431433
```
434+
432435
- Define an opposite workflow, as offically suggested by GitHub: [Handling skipped but required checks](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks)
433436

434437
## Maintainers

action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ inputs:
3131
do_not_skip:
3232
description: 'A JSON-array with triggers that should never be skipped'
3333
required: false
34-
default: '["workflow_dispatch", "schedule"]'
34+
default: '["workflow_dispatch", "schedule", "merge_group"]'
3535
concurrent_skipping:
3636
description: 'One of never, same_content, same_content_newer, outdated_runs, always'
3737
required: true

dist/index.js

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ const workflowRunTriggerOptions = [
2121
'push',
2222
'workflow_dispatch',
2323
'schedule',
24-
'release'
24+
'release',
25+
'merge_group'
2526
] as const
2627
type WorkflowRunTrigger = typeof workflowRunTriggerOptions[number]
2728

0 commit comments

Comments
 (0)