Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: commitlint integration #310

Merged
merged 11 commits into from
Feb 7, 2024
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
1 change: 1 addition & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
28 changes: 28 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CommitLint
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: env | sort
- name: Install commitlint with conventional config
run: npm install --save-dev @commitlint/config-conventional @commitlint/cli
- name: Validate the latest commit message with commitlint
if: github.event_name == 'push'
run: echo "${{ github.event.head_commit.message }}" | npx commitlint
- name: Validate pull request title with commitlint
if: github.event_name == 'pull_request'
run: echo "${{ github.event.pull_request.title }}" | npx commitlint
on:
pull_request:
types:
- opened
- synchronize
- reopened
- edited
push:
branches:
- main
22 changes: 0 additions & 22 deletions .github/workflows/pr.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .gitlab/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
commitlint:
image:
name: commitlint/commitlint:latest
entrypoint: [""]
interruptible: true
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
script:
- |
if [ "$CI_PIPELINE_SOURCE" = "push" ]; then
echo "$CI_COMMIT_TITLE" | commitlint
elif [ "$CI_PIPELINE_SOURCE" = "merge_request_event" ]; then
echo "$CI_MERGE_REQUEST_TITLE" | commitlint
fi
stage: ci
12 changes: 0 additions & 12 deletions .gitlab/workflows/mr.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"autofix",
"automodule",
"cobertura",
"commitlint",
"deepclean",
"deflist",
"devcontainer",
Expand All @@ -35,6 +36,7 @@
"maxdepth",
"modindex",
"mypy",
"noninteractive",
"pathjoin",
"pipenv",
"pipx",
Expand Down Expand Up @@ -151,7 +153,7 @@
],
"vscode-yaml-sort.noCompatMode": true,
"vscode-yaml-sort.sortOnSave": 2,
"vscode-yaml-sort.useArrayProcessor": false,
"vscode-yaml-sort.useArrayProcessor": true,
"vscode-yaml-sort.useBlockProcessor": false,
"vscode-yaml-sort.useCustomSortRecursively": true,
"vscode-yaml-sort.useHelmProcessor": false,
Expand Down
1 change: 1 addition & 0 deletions template/.commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
4 changes: 3 additions & 1 deletion template/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"autofix",
"automodule",
"cobertura",
"commitlint",
"deepclean",
"deflist",
"devcontainer",
Expand All @@ -35,6 +36,7 @@
"maxdepth",
"modindex",
"mypy",
"noninteractive",
"pathjoin",
"pipenv",
"pipx",
Expand Down Expand Up @@ -151,7 +153,7 @@
],
"vscode-yaml-sort.noCompatMode": true,
"vscode-yaml-sort.sortOnSave": 2,
"vscode-yaml-sort.useArrayProcessor": false,
"vscode-yaml-sort.useArrayProcessor": true,
"vscode-yaml-sort.useBlockProcessor": false,
"vscode-yaml-sort.useCustomSortRecursively": true,
"vscode-yaml-sort.useHelmProcessor": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CommitLint
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: env | sort
- name: Install commitlint with conventional config
run: npm install --save-dev @commitlint/config-conventional @commitlint/cli
- name: Validate the latest commit message with commitlint
if: github.event_name == 'push'
run: echo "${{ github.event.head_commit.message }}" | npx commitlint
- name: Validate pull request title with commitlint
if: github.event_name == 'pull_request'
run: echo "${{ github.event.pull_request.title }}" | npx commitlint
on:
pull_request:
types:
- opened
- synchronize
- reopened
- edited
push:
branches:
- main

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
commitlint:
image:
name: commitlint/commitlint:latest
entrypoint: [""]
interruptible: true
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
script:
- |
if [ "$CI_PIPELINE_SOURCE" = "push" ]; then
echo "$CI_COMMIT_TITLE" | commitlint
elif [ "$CI_PIPELINE_SOURCE" = "merge_request_event" ]; then
echo "$CI_MERGE_REQUEST_TITLE" | commitlint
fi
stage: ci

This file was deleted.