-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpull-request-validation-title.yml
More file actions
75 lines (68 loc) · 2.42 KB
/
pull-request-validation-title.yml
File metadata and controls
75 lines (68 loc) · 2.42 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: "Pull request / Validation / Title"
on:
pull_request_target:
types:
- opened
- reopened
- edited
- synchronize
permissions:
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
title-checker:
name: Validate
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5.4.0
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Configure which types are allowed (newline-delimited).
types: |
build
ci
docs
feat
fix
refactor
test
style
revert
translation
# Configure that a scope is optional.
requireScope: false
# Configure additional validation for the subject based on a regex.
# This example ensures the subject doesn't start with an uppercase character, and no dot (.) at the end
subjectPattern: ^[^A-Z].*[^.]$
subjectPatternError: |
The Pull request title didn't match the configured pattern.
Please ensure that the summary:
- doesn't start with an uppercase character
- no dot (.) at the end.
Current summary:
"{subject}"
- uses: marocchino/sticky-pull-request-comment@v2.9.0
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: ${{ always() }}
with:
header: ${{ github.job }}
recreate: true
message: |
👋 Hey there and thank you for opening this pull request!
We require pull request titles to follow the [Conventional Commits specification](https://github.com/PrintMakerLab/.github/blob/main/CONTRIBUTING.md#commit)
ℹ️ Details:
```
${{ steps.lint_pr_title.outputs.error_message || 'Everything is OK!' }}
```
# Delete a previous comment when the issue has been resolved
- if: ${{ always() && steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2.9.0
with:
header: ${{ github.job }}
delete: true
ignore_empty: false