From d5269945832b58ad433327582618d9fd468448a1 Mon Sep 17 00:00:00 2001 From: G <3493448865@qq.com> Date: Sun, 13 Oct 2024 16:35:09 +0800 Subject: [PATCH 1/3] ci:update commitlint --- .github/workflows/commitlint.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index 21f23f6..cde5f23 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -4,7 +4,7 @@ on: push: branches-ignore: ["main"] # 排除 main 分支的 push 事件 pull_request: - branches-ignore: ["main"] # 排除 main 分支的 pull request 事件 + # 移除对 main 分支的排除,使其在 main 分支的 pull request 事件中也能运行 workflow_dispatch: jobs: @@ -20,10 +20,23 @@ jobs: - run: npm install -g @commitlint/cli @commitlint/config-conventional - run: | echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js + - name: Request review + if: github.event_name == 'pull_request' + uses: actions/github-script@v6 + with: + script: | + const { github, context } = require('@actions/github'); + github.pulls.createReviewRequest({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + reviewers: ['${{ github.actor }}'] + }); - name: Check commits run: | if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then - commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose + commitlint --from ${{ github.event.pull_request.base.sha }} --to${{ github.event.pull_request.head.sha }} --verbose else commitlint --from $(git rev-list --max-parents=0 HEAD) --to HEAD --verbose fi + From 60f7e57421bd06aa70c951bb6b6a5a0dbb00c908 Mon Sep 17 00:00:00 2001 From: G <3493448865@qq.com> Date: Sun, 13 Oct 2024 17:47:22 +0800 Subject: [PATCH 2/3] ci:update commitlint, --- .github/workflows/commitlint.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index cde5f23..d5965c7 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -4,7 +4,7 @@ on: push: branches-ignore: ["main"] # 排除 main 分支的 push 事件 pull_request: - # 移除对 main 分支的排除,使其在 main 分支的 pull request 事件中也能运行 + # main 分支的 pull request 事件也会运行 workflow_dispatch: jobs: @@ -25,18 +25,19 @@ jobs: uses: actions/github-script@v6 with: script: | - const { github, context } = require('@actions/github'); github.pulls.createReviewRequest({ owner: context.repo.owner, repo: context.repo.repo, pull_number: context.issue.number, - reviewers: ['${{ github.actor }}'] + reviewers: ['${{ github.actor }}'] }); - name: Check commits run: | if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then - commitlint --from ${{ github.event.pull_request.base.sha }} --to${{ github.event.pull_request.head.sha }} --verbose + commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose else commitlint --from $(git rev-list --max-parents=0 HEAD) --to HEAD --verbose fi + + From 6393df2ddeee37bde75d6f48963f528d43aa21ce Mon Sep 17 00:00:00 2001 From: G <3493448865@qq.com> Date: Sun, 13 Oct 2024 19:21:43 +0800 Subject: [PATCH 3/3] ci:update commitlint --- .github/workflows/commitlint.yml | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index d5965c7..5bf327c 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -3,7 +3,7 @@ name: Commitlint on: push: branches-ignore: ["main"] # 排除 main 分支的 push 事件 - pull_request: + pull_request: # 修正为 pull_request # main 分支的 pull request 事件也会运行 workflow_dispatch: @@ -16,21 +16,10 @@ jobs: fetch-depth: 0 - uses: actions/setup-node@v3 with: - node-version: '20' + node-version: '16' # 使用一个稳定的 Node.js 版本,比如 16 - run: npm install -g @commitlint/cli @commitlint/config-conventional - run: | echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js - - name: Request review - if: github.event_name == 'pull_request' - uses: actions/github-script@v6 - with: - script: | - github.pulls.createReviewRequest({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number, - reviewers: ['${{ github.actor }}'] - }); - name: Check commits run: | if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then @@ -41,3 +30,4 @@ jobs: +