Skip to content

Commit cf36ecf

Browse files
committed
ci: post comment on PR when it fails the semantic pr title
1 parent 4b6cfcf commit cf36ecf

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

.github/workflows/lint-commit.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,39 @@ on:
77
- synchronize
88
- edited
99

10+
permissions:
11+
pull-requests: write
12+
1013
jobs:
1114
commitlint:
1215
runs-on: ubuntu-latest
1316
name: commitlint
14-
1517
steps:
1618
- uses: actions/checkout@v5
1719
- uses: amannn/action-semantic-pull-request@v6
20+
id: lint-pr-title
1821
env:
1922
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2023
with:
2124
subjectPattern: ^(?![A-Z]).+$
25+
- uses: marocchino/sticky-pull-request-comment@v2
26+
if: always() && (steps.lint-pr-title.outputs.error_message != null)
27+
with:
28+
header: pr-title-lint-error
29+
message: |
30+
Hey there and thank you for opening this pull request! 👋🏼
31+
32+
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.
33+
34+
Details:
35+
36+
```
37+
${{ steps.lint-pr-title.outputs.error_message }}
38+
```
39+
40+
- if: ${{ steps.lint-pr-title.outputs.error_message == null }}
41+
uses: marocchino/sticky-pull-request-comment@v2
42+
with:
43+
header: pr-title-lint-error
44+
delete: true
2245

0 commit comments

Comments
 (0)