Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/actions/commitlint/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# commitlint

Internal composite action that validates input against Conventional Commits.

## Inputs

- `input` (required): Input to validate.
- `node-version` (optional): Node.js version used for execution. Defaults to `latest`.

## Example

```yaml
jobs:
check-pr-title:
runs-on: ubuntu-latest
steps:
- uses: dvsa/.github/.github/actions/commitlint@v5
with:
input: ${{ github.event.pull_request.title }}
```

35 changes: 35 additions & 0 deletions .github/actions/commitlint/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: commitlint

description: Validate input against the Conventional Commits specification.

inputs:
input:
description: Input to validate
required: true
node-version:
description: "Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0."
required: false
default: "latest"

runs:
using: composite
steps:
- name: Setup Node.js environment
uses: actions/setup-node@v6
with:
node-version: ${{ inputs.node-version }}
cache: npm
cache-dependency-path: .github/actions/commitlint/package-lock.json

- name: Install dependencies
shell: bash
run: npm ci --prefix "$GITHUB_ACTION_PATH"

- name: Validate input
shell: bash
env:
INPUT: ${{ inputs.input }}
run: |
echo "$INPUT" | npx --no-install --prefix "$GITHUB_ACTION_PATH" commitlint \
--config "$GITHUB_ACTION_PATH/commitlint.config.cjs"

4 changes: 4 additions & 0 deletions .github/actions/commitlint/commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
};

Loading
Loading