65a6890584
This is a followup to https://github.com/tldraw/tldraw/pull/3112 after a discussion with Alex about how our release notes writing is really manual now. This changes the labels to be a more limited set. It also adds a plugin to help massage the release notes into what we want it to be: - ignores bot commits - use the release notes, if found, not the commit msg - skip writing the "release notes" in general, just create the changelog which is what we want anyway. ### Change Type <!-- ❗ Please select a 'Scope' label ❗️ --> - [ ] `sdk` — Changes the tldraw SDK - [ ] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [ ] `internal` — Does not affect user-facing stuff <!-- ❗ Please select a 'Type' label ❗️ --> - [ ] `bugfix` — Bug fix - [ ] `feature` — New feature - [ ] `improvement` — Improving existing features - [ ] `chore` — Updating dependencies, other boring stuff - [ ] `galaxy brain` — Architectural changes - [ ] `tests` — Changes to any test code - [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc. - [ ] `dunno` — I don't know
35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
module.exports = class AutoPlugin {
|
|
constructor() {
|
|
this.name = 'tldraw'
|
|
}
|
|
|
|
apply(auto) {
|
|
// Exclude bots.
|
|
auto.hooks.onCreateLogParse.tap(this.name, (changelog) =>
|
|
changelog.hooks.omitCommit.tap(this.name, (commit) =>
|
|
commit.authors.some((author) => author.type === 'Bot')
|
|
)
|
|
)
|
|
|
|
// Render the release note line, not the commit line.
|
|
auto.hooks.onCreateChangelog.tap(this.name, (changelog) =>
|
|
changelog.hooks.renderChangelogLine.tap(this.name, async (line, commit) => {
|
|
const releaseNote = /### Release Notes\n\n-(.*)/g.exec(
|
|
commit.pullRequest.body.replaceAll('\r\n', '\n')
|
|
)
|
|
return releaseNote
|
|
? `- ${releaseNote[1].trim()} [#${commit.pullRequest.number}](https://github.com/tldraw/tldraw/pull/${commit.pullRequest.number})`
|
|
: line
|
|
})
|
|
)
|
|
|
|
// Only write out changelog, not release notes (they're not very good).
|
|
auto.hooks.onCreateChangelog.tap(this.name, (changelog) =>
|
|
changelog.hooks.omitReleaseNotes.tap(this.name, (commit) => true)
|
|
)
|
|
}
|
|
}
|
|
|
|
function uniq(value, index, array) {
|
|
return array.indexOf(value) === index
|
|
}
|