Skip to content

Commit

Permalink
feat(log): Performance label
Browse files Browse the repository at this point in the history
  • Loading branch information
liweijie0812 committed Sep 26, 2024
1 parent 64d3b6c commit 810ee40
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const fixLabel = ['fix', 'bug', 'hotfix']
const breakingLabel = ['break', 'breaking', 'breaking changes']
const featureLabel = ['feature', 'feat', 'enhancement']
const docsLabel = ['docs', 'doc', 'documentation']
const refactorLabel = ['pref', 'refactor']

export const CHANGELOG_REG = /-\s([A-Z]+)(?:\(([A-Z\s]*)\))?:\s(.+)/gi
export const PULL_NUMBER_REG = /in\shttps:\/\/github\.com\/.+\/pull\/(\d+)/g
export const SKIP_CHANGELOG_REG = /\[x\] 本条 PR 不需要纳入 changelog/i
Expand Down Expand Up @@ -37,6 +39,7 @@ export function renderMarkdown(pullRequestList: PullsData[]) {
breaking: [] as PRChangelog[],
features: [] as PRChangelog[],
bugfix: [] as PRChangelog[],
refactor: [] as PRChangelog[],
docs: [] as PRChangelog[],
extra: [] as PRChangelog[],
}
Expand Down Expand Up @@ -83,6 +86,9 @@ export function renderMarkdown(pullRequestList: PullsData[]) {
else if (isInLabel(fixLabel)) {
categories.bugfix.push(logItem)
}
else if (isInLabel(refactorLabel)) {
categories.refactor.push(logItem)
}
else if (isInLabel(docsLabel)) {
categories.docs.push(logItem)
}
Expand All @@ -102,6 +108,7 @@ export function renderMarkdown(pullRequestList: PullsData[]) {
categories.breaking.length ? `### ❗ Breaking Changes\n${renderCate(categories.breaking)}` : '',
categories.features.length ? `### 🚀 Features\n${renderCate(categories.features)}` : '',
categories.bugfix.length ? `### 🐞 Bug Fixes\n${renderCate(categories.bugfix)}` : '',
categories.refactor.length ? `### 📈 Performance\n${renderCate(categories.refactor)}` : '',
categories.docs.length ? `### 📝 Documentation\n${renderCate(categories.docs)}` : '',
categories.extra.length ? `### 🚧 Others\n${renderCate(categories.extra)}` : '',
].filter(n => n).join('\n')
Expand Down
3 changes: 2 additions & 1 deletion test/__snapshots__/generatorLog.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ exports[`generatorLog > : generatorLogStart 1`] = `
- \`A\`: a bug fix label in fix @liweijie0812 ([#29](https://github.com/TDesignOteam/tdesign-changelog-action/pull/29))
- \`A\`: a bug fix label in hotfix @liweijie0812 ([#29](https://github.com/TDesignOteam/tdesign-changelog-action/pull/29))
- \`A\`: a bug fix label in bug @liweijie0812 ([#29](https://github.com/TDesignOteam/tdesign-changelog-action/pull/29))
### 📈 Performance
- \`I\`: a refactor label in refactor @liweijie0812 ([#29](https://github.com/TDesignOteam/tdesign-changelog-action/pull/29))
### 📝 Documentation
- \`docs\`: a doc change label in docs @liweijie0812 ([#29](https://github.com/TDesignOteam/tdesign-changelog-action/pull/29))
### 🚧 Others
- \`chore\`: a chore label in chore @liweijie0812 ([#29](https://github.com/TDesignOteam/tdesign-changelog-action/pull/29))
- \`I\`: a refactor label in refactor @liweijie0812 ([#29](https://github.com/TDesignOteam/tdesign-changelog-action/pull/29))
"
`;

0 comments on commit 810ee40

Please sign in to comment.