Repository navigation
76 lines (65 loc) · 2.4 KB
/
Copy pathgit-commit-lint.yaml
File metadata and controls
76 lines (65 loc) · 2.4 KB
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
name: Git Commit Linter
on:
workflow_call:
inputs:
commitlint_cli_version:
type: string
required: false
default: "20.4.4"
description: Commitlint CLI Version
commitlint_config_cordada_version:
type: string
required: false
default: "0.1.4"
description: Version of Commitlint Configuration for Cordada
vcs_ref_from:
type: string
required: false
default: ${{ github.event.pull_request.base.sha || github.sha }}
description: VCS Reference Range - From
vcs_ref_to:
type: string
required: false
default: ${{ github.event.pull_request.head.sha || github.sha }}
description: VCS Reference Range - To
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ubuntu-22.04
env:
COMMITLINT_CLI_VERSION: ${{ inputs.commitlint_cli_version }}
COMMITLINT_CONFIG_CORDADA_VERSION: ${{ inputs.commitlint_config_cordada_version }}
CORDADA_NPM_REGISTRY: https://registry.npmjs.org
steps:
- name: Check Out VCS Repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Set Up Node.js
id: set_up_nodejs
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "lts/*"
- name: Restoring/Saving Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: node_modules
key: js-v2-deps-${{ runner.os }}-${{ steps.set_up_nodejs.outputs.node-version }}-${{ env.COMMITLINT_CLI_VERSION }}-${{ env.COMMITLINT_CONFIG_CORDADA_VERSION }}
- name: Install Dependencies
run: |
rm -f package.json package-lock.json
npm config set @cordada:registry="${CORDADA_NPM_REGISTRY}" --location project
npm install @commitlint/cli@"${COMMITLINT_CLI_VERSION}"
npm install @cordada/commitlint-config-cordada@"${COMMITLINT_CONFIG_CORDADA_VERSION}"
env:
npm_config_audit: "false"
npm_config_fund: "false"
- name: Lint Git Commit Messages
run: |
npm exec -- commitlint --from "$VCS_REF_FROM" --to "$VCS_REF_TO" \
--git-log-args='--no-merges'
env:
VCS_REF_FROM: ${{ inputs.vcs_ref_from }}
VCS_REF_TO: ${{ inputs.vcs_ref_to }}