-
Notifications
You must be signed in to change notification settings - Fork 3
53 lines (45 loc) · 1.86 KB
/
commitlint.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Run commitlint on PR
on:
pull_request:
jobs:
run-commitlint-on-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Install dependencies
run: npm install
- uses: 8BitJonny/[email protected]
id: PR
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Verbose setting SHA when using Pull_Request event trigger to fix #16
sha: ${{ github.event.pull_request.head.sha }}
# Only return if PR is still open
filterOutClosed: true
# Only return if PR is not in draft state
filterOutDraft: 1
- run: echo "Your PR is ${prNumber} and its JSON is ${prJSON}"
if: success() && steps.PR.outputs.number
env:
prNumber: ${{ steps.PR.outputs.number }}
# JSON object with the full PR object
prJSON: ${{ steps.PR.outputs.pr }}
# Direct access to common PR properties
prUrl: ${{ steps.PR.outputs.pr_url }}
prTitle: ${{ steps.PR.outputs.pr_title }}
prBody: ${{ steps.PR.outputs.pr_body }}
prCreatedAt: ${{ steps.PR.outputs.pr_created_at }}
prMergedAt: ${{ steps.PR.outputs.pr_merged_at }}
prClosedAt: ${{ steps.PR.outputs.pr_closed_at }}
prLabel: ${{ steps.PR.outputs.pr_labels }}
- name: Validate PR description compliant with Conventional Commits
run: printf "${{ steps.PR.outputs.pr_title }}\n${{ steps.PR.outputs.pr_body }}" | npx commitlint --verbose
if: success() && steps.PR.outputs.number
- name: Validate all commits from PR
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose