-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(workflow): Add reusable CommitLint workflow (#41)
* feat: Add reusable CommitLint workflow * fix * try fix * add sample config * fix? * add missing quotes * fix lint
- Loading branch information
1 parent
5af65bf
commit 9c43683
Showing
3 changed files
with
71 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
# Inherit configuration of a package | ||
include: package:commitlint_cli/commitlint.yaml | ||
|
||
# Custom rules | ||
rules: | ||
type-case: | ||
- 2 | ||
- always | ||
- "lower-case" | ||
|
||
# Whether commitlint uses the default ignore rules. | ||
defaultIgnores: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | ||
name: Reusable - CommitLint | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
node-version: | ||
description: "Node version" | ||
required: false | ||
type: string | ||
default: "latest" | ||
commitlint-version: | ||
description: "Commitlint version" | ||
required: false | ||
type: string | ||
default: "latest" | ||
|
||
jobs: | ||
commitlint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Generate Token | ||
uses: actions/create-github-app-token@3378cda945da322a8db4b193e19d46352ebe2de5 # v1.10.4 | ||
id: app-token | ||
with: | ||
app-id: "${{ secrets.BOT_APP_ID }}" | ||
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}" | ||
|
||
- name: Checkout | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
token: "${{ steps.app-token.outputs.token }}" | ||
|
||
- name: Set up Node | ||
uses: actions/setup-node@v4.0.3 | ||
with: | ||
node-version: "${{ inputs.node-version }}" | ||
|
||
- name: Install commitlint | ||
run: | | ||
npm install conventional-changelog-conventionalcommits | ||
npm install -g @commitlint/cli@${{ inputs.commitlint-version }} | ||
- name: Validate PR commits with commitlint | ||
if: github.event_name == 'pull_request' | ||
env: | ||
PR_TITLE: ${{ github.event.pull_request.title }} | ||
run: | | ||
echo "$PR_TITLE" > file.txt | ||
commitlint --verbose --color -e=file.txt |