From 55c367f783fcd11c4e89754e005815c2ea3fea1f Mon Sep 17 00:00:00 2001 From: SherkeyXD <253294679@qq.com> Date: Tue, 12 Dec 2023 13:58:52 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20pr-checker=E4=BC=98=E5=8C=96=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E6=A0=BC=E5=BC=8F=E5=8F=8A=E6=97=A5=E5=BF=97=E8=BE=93?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr-checker.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-checker.yml b/.github/workflows/pr-checker.yml index c3691325bb..b170794b72 100644 --- a/.github/workflows/pr-checker.yml +++ b/.github/workflows/pr-checker.yml @@ -26,18 +26,18 @@ jobs: const regex = /^((build|chore|ci|docs?|feat|fix|perf|refactor|rft|style|test|i18n|typo)[\:\.\(\,]|[Rr]evert|[Rr]elease)/; const invalidCommits = commits.filter(commit => !regex.test(commit.commit.message) || commit.parents.length > 1); - console.log(`Check ${commits.length} commit(s)`); + console.log(`Checked ${commits.length} commit(s)`); if (invalidCommits.length > 0) { const invalidCommitNames = invalidCommits.map(commit => commit.commit.message); - const invalidCommitInfoList = invalidCommits.map(commit => `- ${commit.commit.message} [\`${commit.sha.substring(0, 7)}\`](${commit.html_url})`).join("\n"); + const invalidCommitInfoList = invalidCommits.map(commit => `- ${commit.commit.message.split("\n")[0]} [\`${commit.sha.substring(0, 7)}\`](${commit.html_url})`).join("\n"); github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.payload.pull_request.number, - body: `Invalid commit(s) found:\n\n${invalidCommitInfoList}\nPlease follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format.` + body: `## ⚠️ Found ${invalidCommits.length} invalid commit(s):\n\n${invalidCommitInfoList}\n\n---\nPlease follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format.` }); - core.setFailed(`Invalid commit(s) found: ${invalidCommitNames.join(", ")}`); + core.setFailed(`Found ${invalidCommits.length} invalid commit(s):\n${invalidCommitNames.join("\n-------------------\n")}`); }