-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathreusable-merge-conflict-check.yml
More file actions
61 lines (57 loc) · 2.35 KB
/
reusable-merge-conflict-check.yml
File metadata and controls
61 lines (57 loc) · 2.35 KB
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
name: Check PRs for merge conflicts
on:
workflow_call:
# Note: the following inputs from the eps1lon/actions-label-merge-conflict
# action runner are not made available as inputs for end-user workflows at this time.
# - repoToken: set to secrets.GITHUB_TOKEN, which should be fine in all cases (except forks).
# - retryAfter: defaults to 120 seconds.
# - retryMax: defaults to 5 times
# - continueOnMissingPermissions: defaults to false
#
# If at some point in the future, there would be a need, these can still be added.
inputs:
dirtyLabel:
description: "Name of the label which indicates that the branch is dirty."
type: string
required: false
default: "merge conflict"
removeOnDirtyLabel:
description: "Name of the label which should be removed."
type: string
required: false
default: ''
commentOnDirty:
description: "Comment to add when the pull request is conflicting. Supports markdown."
type: string
required: false
default: "A merge conflict has been detected for the proposed code changes in this PR. Please resolve the conflict by either rebasing the PR or merging in changes from the base branch."
commentOnClean:
description: "Comment to add when the pull request is not conflicting anymore. Supports markdown."
type: string
required: false
default: ''
jobs:
check-prs:
name: Merge conflict check
runs-on: ubuntu-latest
steps:
- name: "Create label if it doesn't exist"
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
try {
await github.rest.issues.createLabel({
...context.repo,
name: "${{ inputs.dirtyLabel }}"
});
} catch(e) {
// Ignore if labels exist already.
}
- name: Check PRs for merge conflicts
uses: eps1lon/actions-label-merge-conflict@1df065ebe6e3310545d4f4c4e862e43bdca146f0 # v3.0.3
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
dirtyLabel: ${{ inputs.dirtyLabel }}
removeOnDirtyLabel: ${{ inputs.removeOnDirtyLabel }}
commentOnDirty: ${{ inputs.commentOnDirty }}
commentOnClean: ${{ inputs.commentOnClean }}