From f4f1d53070870c655aa6ec554af2fe47b28132cf Mon Sep 17 00:00:00 2001 From: sea <45450994+warmthsea@users.noreply.github.com> Date: Sun, 23 Feb 2025 22:21:11 +0800 Subject: [PATCH] ci: update lint pr title (#19898) * chore(ci): delete lint-commit-message file * ci: update * ci: update --- .../workflows/lint-commit-message-post.yml | 65 +++---------------- .github/workflows/lint-commit-message.yml | 4 +- package.json | 2 +- 3 files changed, 12 insertions(+), 59 deletions(-) diff --git a/.github/workflows/lint-commit-message-post.yml b/.github/workflows/lint-commit-message-post.yml index 2e5cef0b96..e5322292d8 100644 --- a/.github/workflows/lint-commit-message-post.yml +++ b/.github/workflows/lint-commit-message-post.yml @@ -38,75 +38,28 @@ jobs: on-success: runs-on: ubuntu-latest needs: result - if: ${{ needs.result.outputs.succeeded == 'true' }} - name: Lint successfully + name: Lint steps: - - uses: actions-awesome/pr-helper@1.1.1 + - name: successfully + if: ${{ needs.result.outputs.succeeded == 'true' }} + uses: actions-awesome/pr-helper@1.1.1 with: actions: 'maintain-comment, add-labels, remove-labels' token: ${{ github.token }} - labels-to-add: 'CommitMessage::Qualified' labels-to-remove: 'CommitMessage::Unqualified' body-filter: '' pr-number: ${{ needs.result.outputs.pr }} - on-failed: - runs-on: ubuntu-latest - needs: result - name: Lint failed - if: ${{ needs.result.outputs.succeeded != 'true' }} - steps: - - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow.id }} - run_id: ${{ github.event.workflow_run.id }} - name: commit-lint-report - - - name: Read lint result - id: read - uses: juliangruber/read-file-action@v1 - with: - path: ./commit-lint.txt - - - uses: actions-awesome/pr-helper@1.1.1 + - name: failed + if: ${{ needs.result.outputs.succeeded != 'true' }} + uses: actions-awesome/pr-helper@1.1.1 with: actions: 'remove-labels, add-labels, maintain-comment' - labels-to-remove: 'CommitMessage::Qualified' labels-to-add: 'CommitMessage::Unqualified' token: ${{ github.token }} pr-number: ${{ needs.result.outputs.pr }} comment-body: | - Hello, @${{ github.event.pull_request.user.login }}, seems like your commit message contains some issues. - - 你好,@${{ github.event.pull_request.user.login }},你的提交消息不符合 Element Plus 的提交消息规范。 - - ``` - ${{ steps.read.outputs.content }} - ``` - - Please refer to [Commit Example](https://element-plus.org/en-US/guide/commit-examples.html) for fixing it. - - 请参考 [提交示例](https://element-plus.org/en-US/guide/commit-examples.html) 来修改你的提交消息。 - - Note that all your commits will be squashed into one for being linted, so you might need to revision your commits. - If you do not know how to do so, please refer to [Keeping git commit history clean](https://about.gitlab.com/blog/2018/06/07/keeping-git-commit-history-clean/) to update your commit message. - - 你的所有 commit(s) 会被合并为一个 commit 来被验证,所以你可能需要修改你之前的 commit(s) 消息。 - 如果你不知道如何来修改之前已经提交的记录,请参考[让你的 Git 提交历史保持干净](https://about.gitlab.com/blog/2018/06/07/keeping-git-commit-history-clean/)来修改。 - - If you find it hard to do it by yourself, run command below to use an intuitive tool for that. - - 如果你觉得自己写这个提交消息很难,请使用下面的命令来启动一个交互式工具来帮助你生成消息。 - - ```shell - pnpm cz - ``` - - Note that if you do not fix the commit message issue, your PR will be automatically closed within **3 days**. - - 请注意,如果你没有按照规范修改你的提交消息,你的 PR 将会在**三天**内被自动关闭。 - - Generated with :heart: by ElementPlusBot + Hello, @${{ github.event.pull_request.user.login }}, your PR title does not meet the standards, please [refer to here](https://github.com/element-plus/element-plus/commits/dev/). + 你好,@${{ github.event.pull_request.user.login }},你的 PR 标题不符合规范,[请参考这里](https://github.com/element-plus/element-plus/commits/dev/)。 body-filter: '' - - run: exit 1 diff --git a/.github/workflows/lint-commit-message.yml b/.github/workflows/lint-commit-message.yml index 04c7df5b5b..e2a9cbfb93 100644 --- a/.github/workflows/lint-commit-message.yml +++ b/.github/workflows/lint-commit-message.yml @@ -2,7 +2,7 @@ name: Lint Commit Message on: pull_request: - types: [opened, synchronize, reopened] + types: [opened, edited, reopened] jobs: lint: @@ -42,7 +42,7 @@ jobs: - name: Lint commit id: lint_commit - run: pnpm lint:commit || echo "failed=true" >> $GITHUB_OUTPUT + run: echo "${{ github.event.pull_request.title }}" | pnpm run lint:commit || echo "failed=true" >> $GITHUB_OUTPUT - name: Set success result if: ${{ steps.lint_commit.outputs.failed != 'true' }} diff --git a/package.json b/package.json index 86d6d2a92e..ac5c173e47 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "format": "prettier --write --cache .", "lint": "eslint . --ext .vue,.js,.ts,.jsx,.tsx,.md,.json --max-warnings 0 --cache", "lint:fix": "pnpm run lint --fix", - "lint:commit": "commitlint --from $(git merge-base origin/dev HEAD) --to HEAD > ./commit-lint.txt", + "lint:commit": "commitlint", "typecheck": "run-p typecheck:web typecheck:play typecheck:node typecheck:vite-config typecheck:vitest", "typecheck:web": "vue-tsc -p tsconfig.web.json --composite false --noEmit", "typecheck:node": "tsc -p tsconfig.node.json --noEmit",