Skip to content

Commit 01a8e06

Browse files
feat(conventional-commits): add sticky comments for PR title linting (#57)
1 parent 687421d commit 01a8e06

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/conventional-commits.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,27 @@ jobs:
1313
- uses: amannn/action-semantic-pull-request@v5
1414
env:
1515
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
17+
- uses: marocchino/sticky-pull-request-comment@v2
18+
# When the previous steps fails, the workflow would stop. By adding this
19+
# condition you can continue the execution with the populated error message.
20+
if: always() && (steps.lint_pr_title.outputs.error_message != null)
21+
with:
22+
header: pr-title-lint-error
23+
message: |
24+
Hey there and thank you for opening this pull request! 👋🏼
25+
26+
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.
27+
28+
Details:
29+
30+
```
31+
${{ steps.lint_pr_title.outputs.error_message }}
32+
```
33+
34+
# Delete a previous comment when the issue has been resolved
35+
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
36+
uses: marocchino/sticky-pull-request-comment@v2
37+
with:
38+
header: pr-title-lint-error
39+
delete: true

0 commit comments

Comments
 (0)