From 23ce8d4269e341e30079bd7d45bb9729b1c5f498 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Tue, 21 May 2024 16:54:31 +0800 Subject: [PATCH 1/3] ci: extend commitlint in cli --- .github/workflows/commitlint.yml | 5 ++--- .gitlab/workflows/commitlint.yml | 8 +++++--- package.json | 5 ----- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index 4a04494a..88bda37d 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -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: diff --git a/.gitlab/workflows/commitlint.yml b/.gitlab/workflows/commitlint.yml index f2fcad26..301f613b 100644 --- a/.gitlab/workflows/commitlint.yml +++ b/.gitlab/workflows/commitlint.yml @@ -1,7 +1,7 @@ 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" @@ -9,8 +9,10 @@ commitlint: 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 diff --git a/package.json b/package.json index 71a24212..7f4574f5 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,4 @@ { - "commitlint": { - "extends": [ - "@commitlint/config-conventional" - ] - }, "release": { "plugins": [ [ From ffc80d83e789a7276b5d1e43762f1822bb27a08a Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Tue, 21 May 2024 16:56:57 +0800 Subject: [PATCH 2/3] update template --- .../workflows/commitlint.yml | 5 ++--- .../workflows/commitlint.yml | 8 +++++--- template/package.json.jinja | 5 ----- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/commitlint.yml b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/commitlint.yml index 4a04494a..88bda37d 100644 --- a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/commitlint.yml +++ b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/commitlint.yml @@ -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: diff --git a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/commitlint.yml b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/commitlint.yml index f2fcad26..301f613b 100644 --- a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/commitlint.yml +++ b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/commitlint.yml @@ -1,7 +1,7 @@ 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" @@ -9,8 +9,10 @@ commitlint: 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 diff --git a/template/package.json.jinja b/template/package.json.jinja index ce0ba734..c014419c 100644 --- a/template/package.json.jinja +++ b/template/package.json.jinja @@ -1,9 +1,4 @@ { - "commitlint": { - "extends": [ - "@commitlint/config-conventional" - ] - }, "release": { "plugins": [ [ From 4c2404859379f5d8d2e5b88e2e9c9fd1f8c66de8 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Tue, 21 May 2024 17:01:08 +0800 Subject: [PATCH 3/3] rename package.json to .releaserc.json --- package.json => .releaserc.json | 0 template/{package.json.jinja => .releaserc.json.jinja} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename package.json => .releaserc.json (100%) rename template/{package.json.jinja => .releaserc.json.jinja} (100%) diff --git a/package.json b/.releaserc.json similarity index 100% rename from package.json rename to .releaserc.json diff --git a/template/package.json.jinja b/template/.releaserc.json.jinja similarity index 100% rename from template/package.json.jinja rename to template/.releaserc.json.jinja