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: extend commitlint in cli #573

Merged
merged 3 commits into from
May 21, 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
5 changes: 2 additions & 3 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ jobs:
runs-on: ubuntu-22.04
steps:
- run: env | sort
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Validate the latest commit message with commitlint
if: github.event_name == 'push'
run: echo "${{ github.event.head_commit.message }}" | npx commitlint
run: echo "${{ github.event.head_commit.message }}" | npx commitlint -x @commitlint/config-conventional
huxuan marked this conversation as resolved.
Show resolved Hide resolved
- name: Validate pull request title with commitlint
if: github.event_name == 'pull_request'
run: echo "${{ github.event.pull_request.title }}" | npx commitlint
run: echo "${{ github.event.pull_request.title }}" | npx commitlint -x @commitlint/config-conventional
on:
pull_request:
types:
Expand Down
8 changes: 5 additions & 3 deletions .gitlab/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
commitlint:
image:
name: commitlint/commitlint:19.3.1@sha256:02c8c31b2c61c51eadb410960648c8b370f7583609f4ca1520155eeeefd63d66
entrypoint: [""]
entrypoint: ['']
interruptible: true
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
script:
- |
if [ "$CI_PIPELINE_SOURCE" = "push" ]; then
echo "$CI_COMMIT_TITLE" | commitlint
echo "$CI_COMMIT_TITLE" | commitlint -x @commitlint/config-conventional
elif [ "$CI_PIPELINE_SOURCE" = "merge_request_event" ]; then
echo "$CI_MERGE_REQUEST_TITLE" | commitlint
echo "$CI_MERGE_REQUEST_TITLE" | commitlint -x @commitlint/config-conventional
fi
stage: ci
variables:
GIT_STRATEGY: none
5 changes: 0 additions & 5 deletions package.json → .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"release": {
"plugins": [
[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"release": {
"plugins": [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ jobs:
runs-on: ubuntu-22.04
steps:
- run: env | sort
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Validate the latest commit message with commitlint
if: github.event_name == 'push'
run: echo "${{ github.event.head_commit.message }}" | npx commitlint
run: echo "${{ github.event.head_commit.message }}" | npx commitlint -x @commitlint/config-conventional
- name: Validate pull request title with commitlint
if: github.event_name == 'pull_request'
run: echo "${{ github.event.pull_request.title }}" | npx commitlint
run: echo "${{ github.event.pull_request.title }}" | npx commitlint -x @commitlint/config-conventional
on:
pull_request:
types:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
commitlint:
image:
name: commitlint/commitlint:19.3.1@sha256:02c8c31b2c61c51eadb410960648c8b370f7583609f4ca1520155eeeefd63d66
entrypoint: [""]
entrypoint: ['']
interruptible: true
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
script:
- |
if [ "$CI_PIPELINE_SOURCE" = "push" ]; then
echo "$CI_COMMIT_TITLE" | commitlint
echo "$CI_COMMIT_TITLE" | commitlint -x @commitlint/config-conventional
elif [ "$CI_PIPELINE_SOURCE" = "merge_request_event" ]; then
echo "$CI_MERGE_REQUEST_TITLE" | commitlint
echo "$CI_MERGE_REQUEST_TITLE" | commitlint -x @commitlint/config-conventional
fi
stage: ci
variables:
GIT_STRATEGY: none