From 80cb53c9f80241dbb94602e320f146ff79488efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E4=BC=9F=E6=9D=B0?= <674416404@qq.com> Date: Sat, 7 Sep 2024 21:48:25 +0800 Subject: [PATCH] feat: update PULL_NUMBER_REG --- src/renderer.ts | 2 +- test/__snapshots__/regexp.test.ts.snap | 42 +++++++++----------------- 2 files changed, 15 insertions(+), 29 deletions(-) diff --git a/src/renderer.ts b/src/renderer.ts index f93996c..b2210e3 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -6,7 +6,7 @@ const fixLabel = ['fix', 'bug', 'hotfix'] const breakingLabel = ['break', 'breaking', 'breaking changes'] const featureLabel = ['feature', 'feat', 'enhancement'] export const CHANGELOG_REG = /-\s([A-Z]+)(?:\(([A-Z\s]*)\))?:\s(.+)/gi -export const PULL_NUMBER_REG = /in\shttps:\/\/github\.com\/.+\/pull\/(\d+)\s/g +export const PULL_NUMBER_REG = /in\shttps:\/\/github\.com\/.+\/pull\/(\d+)/g export const SKIP_CHANGELOG_REG = /\[x\] 本条 PR 不需要纳入 changelog/i export function getPullNumbers(body: string) { const arr = [...body.matchAll(PULL_NUMBER_REG)] diff --git a/test/__snapshots__/regexp.test.ts.snap b/test/__snapshots__/regexp.test.ts.snap index ce24d77..0480b36 100644 --- a/test/__snapshots__/regexp.test.ts.snap +++ b/test/__snapshots__/regexp.test.ts.snap @@ -86,73 +86,59 @@ exports[`regexp > : CHANGELOG_REG 1`] = ` exports[`regexp > : PULL_NUMBER_REG 1`] = ` [ [ - "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/7 -", + "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/7", "7", ], [ - "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/14 -", + "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/14", "14", ], [ - "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/15 -", + "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/15", "15", ], [ - "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/16 -", + "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/16", "16", ], [ - "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/17 -", + "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/17", "17", ], [ - "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/18 -", + "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/18", "18", ], [ - "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/19 -", + "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/19", "19", ], [ - "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/20 -", + "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/20", "20", ], [ - "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/21 -", + "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/21", "21", ], [ - "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/23 -", + "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/23", "23", ], [ - "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/25 -", + "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/25", "25", ], [ - "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/26 -", + "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/26", "26", ], [ - "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/27 -", + "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/27", "27", ], [ - "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/28 -", + "in https://github.com/TDesignOteam/tdesign-changelog-action/pull/28", "28", ], ]