-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (72 loc) · 2.46 KB
/
commitlint.yml
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Use commitlint to ensure commit messages follow the Conventional Commits specification.
#
# References:
# - commitlint: https://commitlint.js.org
# - Conventional Commits: https://www.conventionalcommits.org
name: ♻ commitlint
on:
workflow_call:
inputs:
runs_on:
description: The label of the runner (GitHub- or self-hosted) to run this workflow on. Defaults to `ubuntu-24.04`.
type: string
required: false
default: ubuntu-24.04
node_version:
description: The version of Node.js to install.
type: string
required: false
default: lts/*
commitlint_version:
description: The version of commitlint to install.
type: string
required: false
default: latest
extends:
description: |
Newline-separated string of shareable configurations to install.
Additional configuration can be set in a file `.commitlintrc` (https://commitlint.js.org/reference/configuration.html).
type: string
required: false
default: |-
@commitlint/config-conventional
message:
description: Commit message to lint. Default is latest commit message.
type: string
required: false
default: ${{ github.event.head_commit.message }}
help_url:
description: Custom help URL for error messages.
type: string
required: false
permissions: {}
jobs:
commitlint:
name: commitlint
runs-on: ${{ inputs.runs_on }}
permissions:
contents: read # Required to checkout the repository
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version: ${{ inputs.node_version }}
- name: Install dependencies
env:
EXTENDS: ${{ inputs.extends }}
run: |
readarray -t extends_array <<< "$EXTENDS"
npm install "${extends_array[@]}"
- name: Lint
env:
VERSION: ${{ inputs.commitlint_version }}
EXTENDS: ${{ inputs.extends }}
MESSAGE: ${{ inputs.message }}
HELP_URL: ${{ inputs.help_url }}
run: |
readarray -t extends_array <<< "$EXTENDS"
npx "commitlint@$VERSION" --extends "${extends_array[@]}" --help-url "$HELP_URL" <<< "$MESSAGE"