Skip to content

Commit f7e2772

Browse files
committed
ci: shared workflow dont work in public repo. Copy content into workflow
1 parent e2dc1a5 commit f7e2772

File tree

1 file changed

+56
-20
lines changed

1 file changed

+56
-20
lines changed

.github/workflows/lint-pr-title.yml

+56-20
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,56 @@
1-
name: "[lint] Commit is conventional"
2-
3-
on:
4-
pull_request_target:
5-
types:
6-
- edited
7-
- opened
8-
- ready_for_review
9-
- reopened
10-
- synchronize
11-
12-
permissions:
13-
contents: read
14-
id-token: write
15-
pull-requests: write
16-
17-
jobs:
18-
lint:
19-
name: Lint
20-
uses: kolonialno/actions/.github/workflows/pr-conventional-commit.yml@main
1+
---
2+
# When squash merge the PR title becomes the commit message.
3+
# When you require conventional commits
4+
# the title must also be conventional.
5+
name: "[lint] Conventional commit"
6+
7+
on:
8+
pull_request_target:
9+
types:
10+
- edited
11+
- opened
12+
- ready_for_review
13+
- reopened
14+
- synchronize
15+
workflow_call:
16+
workflow_dispatch:
17+
18+
permissions:
19+
contents: read
20+
id-token: write
21+
pull-requests: write
22+
23+
jobs:
24+
main:
25+
name: Validate PR title
26+
runs-on: ubuntu-latest
27+
if: github.event.pull_request.draft == false
28+
steps:
29+
- uses: amannn/action-semantic-pull-request@v5
30+
id: lint_pr_title
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- uses: marocchino/sticky-pull-request-comment@v2
35+
# When the previous steps fails, the workflow would stop. By adding this
36+
# condition you can continue the execution with the populated error message.
37+
if: always() && (steps.lint_pr_title.outputs.error_message != null)
38+
with:
39+
header: pr-title-lint-error
40+
message: |
41+
Hey there and thank you for opening this pull request! 👋🏼
42+
43+
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.
44+
45+
Details:
46+
47+
```
48+
${{ steps.lint_pr_title.outputs.error_message }}
49+
```
50+
51+
# Delete a previous comment when the issue has been resolved
52+
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
53+
uses: marocchino/sticky-pull-request-comment@v2
54+
with:
55+
header: pr-title-lint-error
56+
delete: true

0 commit comments

Comments
 (0)