Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3117305

Browse files
committedNov 11, 2024·
build(gha): add smenatic-validate PR step
1 parent d34f8b8 commit 3117305

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
 

‎.github/workflows/pull-request.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,36 @@ jobs:
100100
image-ref: ${{ env.IMAGE }}
101101
format: "table"
102102
exit-code: "1"
103+
104+
semantic-validate:
105+
name: Validate PR title
106+
runs-on: ubuntu-latest
107+
steps:
108+
- uses: amannn/action-semantic-pull-request@v5
109+
id: lint_pr_title
110+
env:
111+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
113+
- uses: marocchino/sticky-pull-request-comment@v2
114+
# When the previous steps fails, the workflow would stop. By adding this
115+
# condition you can continue the execution with the populated error message.
116+
if: always() && (steps.lint_pr_title.outputs.error_message != null)
117+
with:
118+
header: pr-title-lint-error
119+
message: |
120+
Hey there and thank you for opening this pull request! 👋🏼
121+
122+
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.
123+
124+
Details:
125+
126+
```
127+
${{ steps.lint_pr_title.outputs.error_message }}
128+
```
129+
130+
# Delete a previous comment when the issue has been resolved
131+
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
132+
uses: marocchino/sticky-pull-request-comment@v2
133+
with:
134+
header: pr-title-lint-error
135+
delete: true

0 commit comments

Comments
 (0)
Please sign in to comment.