From fcd5d2fdab02fa9f754742c05afc2630c79a93a9 Mon Sep 17 00:00:00 2001 From: sea <45450994+warmthsea@users.noreply.github.com> Date: Tue, 25 Feb 2025 10:41:37 +0800 Subject: [PATCH] ci: fix lint-pr-title comment (#19947) * ci: fix lint-pr-title username is empty * ci: update --- .../workflows/lint-commit-message-post.yml | 65 ------------------- .github/workflows/lint-commit-message.yml | 36 +++++----- 2 files changed, 17 insertions(+), 84 deletions(-) delete mode 100644 .github/workflows/lint-commit-message-post.yml diff --git a/.github/workflows/lint-commit-message-post.yml b/.github/workflows/lint-commit-message-post.yml deleted file mode 100644 index e5322292d8..0000000000 --- a/.github/workflows/lint-commit-message-post.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: 📮 Lint Commit Message Post - -on: - workflow_run: - workflows: ['Lint Commit Message'] - types: [completed] - -jobs: - result: - runs-on: ubuntu-latest - - outputs: - succeeded: ${{ steps.assert.outputs.succeeded }} - pr: ${{ steps.pr.outputs.pr }} - - steps: - - name: Download result - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow.id }} - run_id: ${{ github.event.workflow_run.id }} - name: commit-lint-result - - - name: Derive PR number - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow.id }} - run_id: ${{ github.event.workflow_run.id }} - name: pr-number - - - name: Assert result - id: assert - run: echo "succeeded=$(> $GITHUB_OUTPUT - - name: Get PR number - id: pr - run: echo "pr=$(> $GITHUB_OUTPUT - - on-success: - runs-on: ubuntu-latest - needs: result - name: Lint - steps: - - 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-remove: 'CommitMessage::Unqualified' - body-filter: '' - pr-number: ${{ needs.result.outputs.pr }} - - - 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-add: 'CommitMessage::Unqualified' - token: ${{ github.token }} - pr-number: ${{ needs.result.outputs.pr }} - comment-body: | - 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: '' diff --git a/.github/workflows/lint-commit-message.yml b/.github/workflows/lint-commit-message.yml index e2a9cbfb93..fdce70b96b 100644 --- a/.github/workflows/lint-commit-message.yml +++ b/.github/workflows/lint-commit-message.yml @@ -46,26 +46,24 @@ jobs: - name: Set success result if: ${{ steps.lint_commit.outputs.failed != 'true' }} - run: echo 'true' > ./lint-result.txt + uses: actions-awesome/pr-helper@1.1.1 + with: + actions: 'maintain-comment, add-labels, remove-labels' + token: ${{ github.token }} + labels-to-remove: 'CommitMessage::Unqualified' + body-filter: '' + pr-number: ${{ github.event.number }} - name: Set failed result if: ${{ steps.lint_commit.outputs.failed == 'true' }} - run: echo 'false' > ./lint-result.txt - - - name: Set PR number - run: echo $PULL_REQUEST_NUMBER > pr.txt - - - uses: actions/upload-artifact@v4 + uses: actions-awesome/pr-helper@1.1.1 with: - name: commit-lint-report - path: ./commit-lint.txt - - - uses: actions/upload-artifact@v4 - with: - name: commit-lint-result - path: ./lint-result.txt - - - uses: actions/upload-artifact@v4 - with: - name: pr-number - path: ./pr.txt + actions: 'remove-labels, add-labels, maintain-comment' + labels-to-add: 'CommitMessage::Unqualified' + token: ${{ github.token }} + pr-number: ${{ github.event.number }} + comment-body: | + Hello, @${{ github.event.pull_request.user.login }}, your PR title does not meet the standards, please refer to [commit-history](https://github.com/element-plus/element-plus/commits/dev/) or [docs-examples](https://element-plus.org/en-US/guide/commit-examples.html) make changes. + 你好,@${{ github.event.pull_request.user.login }},你的 PR 标题不符合规范,请参考 [提交历史](https://github.com/element-plus/element-plus/commits/dev/) 或者 [文档示例](https://element-plus.org/en-US/guide/commit-examples.html) 进行修改。 + + body-filter: ''