Skip to content

Commit 09c0170

Browse files
chore: GitHub Action for proper PR titles (#604)
1 parent d893d0d commit 09c0170

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "Validate PRs"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- reopened
8+
- edited
9+
- synchronize
10+
11+
permissions:
12+
pull-requests: write
13+
14+
jobs:
15+
validate-pr:
16+
name: Validate PR title
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: amannn/action-semantic-pull-request@v5
20+
id: lint_pr_title
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- uses: marocchino/sticky-pull-request-comment@v2
25+
# When the previous steps fails, the workflow would stop. By adding this
26+
# condition you can continue the execution with the populated error message.
27+
if: always() && (steps.lint_pr_title.outputs.error_message != null)
28+
with:
29+
header: pr-title-lint-error
30+
message: |
31+
Hey there and thank you for opening this pull request! 👋🏼
32+
33+
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.
34+
35+
Details:
36+
37+
```
38+
${{ steps.lint_pr_title.outputs.error_message }}
39+
```

0 commit comments

Comments
 (0)