Skip to content

Commit dbb3b35

Browse files
authored
ci: lint pr name (#49)
1 parent 0a91568 commit dbb3b35

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: 'Lint PR name'
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
main:
12+
name: Validate PR title
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: amannn/action-semantic-pull-request@v5
16+
id: lint_pr_title
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- uses: marocchino/sticky-pull-request-comment@v2
21+
# When the previous steps fails, the workflow would stop. By adding this
22+
# condition you can continue the execution with the populated error message.
23+
if: always() && (steps.lint_pr_title.outputs.error_message != null)
24+
with:
25+
header: pr-title-lint-error
26+
message: |
27+
Hey there and thank you for opening this pull request! 👋🏼
28+
29+
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
30+
31+
Details:
32+
33+
```
34+
${{ steps.lint_pr_title.outputs.error_message }}
35+
```
36+
37+
# Delete a previous comment when the issue has been resolved
38+
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
39+
uses: marocchino/sticky-pull-request-comment@v2
40+
with:
41+
header: pr-title-lint-error
42+
delete: true

0 commit comments

Comments
 (0)