Skip to content

Commit 82cbf2b

Browse files
committed
feat(conventional-commits): add error handling
1 parent c1e63c7 commit 82cbf2b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

.github/workflows/conventional-commits.yml

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

0 commit comments

Comments
 (0)