Skip to content

Commit

Permalink
ci: extend commitlint in cli (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
huxuan authored May 21, 2024
1 parent 3e6e072 commit cfb19c6
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 22 deletions.
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
- 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

0 comments on commit cfb19c6

Please sign in to comment.