Skip to content

Commit e94ee53

Browse files
authored
feat: support Github Action to validate PR commits (#8)
1 parent 40105b0 commit e94ee53

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

.github/workflows/pr_commits.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
on:
2+
pull_request:
3+
branches: [ "main" ]
4+
types: [opened, synchronize]
5+
6+
jobs:
7+
validate:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
with:
12+
fetch-depth: 0
13+
ref: ${{ github.head_ref }}
14+
15+
- uses: dart-lang/[email protected]
16+
17+
- name: Get Dependencies
18+
run: dart pub get
19+
20+
- name: Validate PR Commits
21+
run: VERBOSE=true dart run commitlint_cli --from="origin/${{ github.base_ref }}" --to="${{ github.head_ref }}" --config lib/commitlint.yaml

docs/guides-setup.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ No staged files match any of provided globs.
6262
husky - commit-msg hook exited with code 1 (add --no-verify to bypass)
6363
```
6464

65-
## Setup Github CI
65+
## Setup Github Actions
6666

67+
### Validate PR Title
6768
Add `.github/workflows/pr_title.yml`
6869
```yaml
6970
on:
@@ -83,4 +84,30 @@ jobs:
8384

8485
- name: Validate Title of PR
8586
run: echo ${{ github.event.pull_request.title }} | dart run commitlint_cli
86-
```
87+
```
88+
89+
### Validate PR Commits
90+
Add `.github/workflows/pr_commits.yml`
91+
```yaml
92+
on:
93+
pull_request:
94+
branches: [ "main" ]
95+
types: [opened, synchronize]
96+
97+
jobs:
98+
validate:
99+
runs-on: ubuntu-latest
100+
steps:
101+
- uses: actions/checkout@v3
102+
with:
103+
fetch-depth: 0
104+
ref: ${{ github.head_ref }}
105+
106+
- uses: dart-lang/[email protected]
107+
108+
- name: Get Dependencies
109+
run: dart pub get
110+
111+
- name: Validate PR Commits
112+
run: dart run commitlint_cli --from="origin/${{ github.base_ref }}" --to="${{ github.head_ref }}"
113+
```

0 commit comments

Comments
 (0)