dx: PR labels re-revamp (#4016)
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
This commit is contained in:
parent
a2ebf2984b
commit
65a6890584
5 changed files with 62 additions and 67 deletions
|
@ -26,6 +26,7 @@ apps/vscode/extension/editor/index.js
|
||||||
apps/vscode/extension/editor/tldraw-assets.json
|
apps/vscode/extension/editor/tldraw-assets.json
|
||||||
**/sentry.server.config.js
|
**/sentry.server.config.js
|
||||||
**/scripts/upload-sourcemaps.js
|
**/scripts/upload-sourcemaps.js
|
||||||
|
**/scripts/lib/auto-plugin.js
|
||||||
**/coverage/**/*
|
**/coverage/**/*
|
||||||
|
|
||||||
apps/dotcom/public/sw.js
|
apps/dotcom/public/sw.js
|
||||||
|
|
18
.github/pull_request_template.md
vendored
18
.github/pull_request_template.md
vendored
|
@ -2,24 +2,14 @@ Describe what your pull request does. If appropriate, add GIFs or images showing
|
||||||
|
|
||||||
### Change Type
|
### 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 ❗️ -->
|
<!-- ❗ Please select a 'Type' label ❗️ -->
|
||||||
|
|
||||||
- [ ] `bugfix` — Bug fix
|
|
||||||
- [ ] `feature` — New feature
|
- [ ] `feature` — New feature
|
||||||
- [ ] `improvement` — Improving existing features
|
- [ ] `improvement` — Product improvement
|
||||||
- [ ] `chore` — Updating dependencies, other boring stuff
|
- [ ] `api` — API change
|
||||||
- [ ] `galaxy brain` — Architectural changes
|
- [ ] `bugfix` — Bug fix
|
||||||
- [ ] `tests` — Changes to any test code
|
- [ ] `other` — Changes that don't affect SDK users, e.g. internal or .com changes
|
||||||
- [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc.
|
|
||||||
- [ ] `dunno` — I don't know
|
|
||||||
|
|
||||||
|
|
||||||
### Test Plan
|
### Test Plan
|
||||||
|
|
|
@ -56,6 +56,10 @@ export const enforcePrLabels: Flow = {
|
||||||
return fail('Please add a label to the PR.')
|
return fail('Please add a label to the PR.')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pull.body?.includes('Add a brief release note for your PR here.')) {
|
||||||
|
return fail('Add a release note to the PR body.')
|
||||||
|
}
|
||||||
|
|
||||||
// add any labels that are checked
|
// add any labels that are checked
|
||||||
console.log('adding labels')
|
console.log('adding labels')
|
||||||
if (selectedReleaseLabels.length > 0) {
|
if (selectedReleaseLabels.length > 0) {
|
||||||
|
|
35
scripts/lib/auto-plugin.js
Normal file
35
scripts/lib/auto-plugin.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
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
|
||||||
|
}
|
|
@ -10,63 +10,32 @@ interface Label {
|
||||||
changelogTitle: string
|
changelogTitle: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const SCOPE_LABELS = [
|
|
||||||
{
|
|
||||||
name: `sdk`,
|
|
||||||
description: `Changes the tldraw SDK`,
|
|
||||||
changelogTitle: '📚 SDK Changes',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `dotcom`,
|
|
||||||
description: `Changes the tldraw.com web app`,
|
|
||||||
changelogTitle: '🖥️ tldraw.com Changes',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `docs`,
|
|
||||||
description: `Changes to the documentation, examples, or templates.`,
|
|
||||||
changelogTitle: '📖 Documentation changes',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `vs code`,
|
|
||||||
description: `Changes to the vscode plugin`,
|
|
||||||
changelogTitle: '👩💻 VS Code Plugin Changes',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `internal`,
|
|
||||||
description: `Does not affect user-facing stuff`,
|
|
||||||
changelogTitle: '🕵️♀️ Internal Changes',
|
|
||||||
},
|
|
||||||
] as const satisfies Label[]
|
|
||||||
|
|
||||||
const TYPE_LABELS = [
|
const TYPE_LABELS = [
|
||||||
{ name: `bugfix`, description: `Bug fix`, changelogTitle: '🐛 Bug Fixes' },
|
{
|
||||||
{ name: `feature`, description: `New feature`, changelogTitle: '🚀 Features' },
|
name: `feature`,
|
||||||
|
description: `New feature`,
|
||||||
|
changelogTitle: '🎉 New Features',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: `improvement`,
|
name: `improvement`,
|
||||||
description: `Improving existing features`,
|
description: `Product improvement`,
|
||||||
changelogTitle: '💄 Improvements',
|
changelogTitle: '💄 Product Improvements',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `chore`,
|
name: `api`,
|
||||||
description: `Updating dependencies, other boring stuff`,
|
description: `API change`,
|
||||||
changelogTitle: '🧹 Chores',
|
changelogTitle: '🛠️ API Changes',
|
||||||
},
|
},
|
||||||
|
{ name: `bugfix`, description: `Bug fix`, changelogTitle: '🐛 Bug Fixes' },
|
||||||
{
|
{
|
||||||
name: `galaxy brain`,
|
name: `other`,
|
||||||
description: `Architectural changes`,
|
description: `Changes that don't affect SDK users, e.g. internal or .com changes`,
|
||||||
changelogTitle: '🤯 Architectural changes',
|
changelogTitle: '🤷 Other',
|
||||||
},
|
},
|
||||||
{ name: `tests`, description: `Changes to any test code`, changelogTitle: '🧪 Tests' },
|
|
||||||
{
|
|
||||||
name: `tools`,
|
|
||||||
description: `Changes to infrastructure, CI, internal scripts, debugging tools, etc.`,
|
|
||||||
changelogTitle: '🛠️ Tools',
|
|
||||||
},
|
|
||||||
{ name: `dunno`, description: `I don't know`, changelogTitle: '🤷 Dunno' },
|
|
||||||
] as const satisfies Label[]
|
] as const satisfies Label[]
|
||||||
|
|
||||||
export function getLabelNames() {
|
export function getLabelNames() {
|
||||||
return [...SCOPE_LABELS, ...TYPE_LABELS].map((label) => label.name)
|
return [...TYPE_LABELS].map((label) => label.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatTemplateOption(label: Label) {
|
function formatTemplateOption(label: Label) {
|
||||||
|
@ -74,11 +43,7 @@ function formatTemplateOption(label: Label) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatLabelOptionsForPRTemplate() {
|
export function formatLabelOptionsForPRTemplate() {
|
||||||
let result = `<!-- ❗ Please select a 'Scope' label ❗️ -->\n\n`
|
let result = `\n<!-- ❗ Please select a 'Type' label ❗️ -->\n\n`
|
||||||
for (const label of SCOPE_LABELS) {
|
|
||||||
result += formatTemplateOption(label) + '\n'
|
|
||||||
}
|
|
||||||
result += `\n<!-- ❗ Please select a 'Type' label ❗️ -->\n\n`
|
|
||||||
for (const label of TYPE_LABELS) {
|
for (const label of TYPE_LABELS) {
|
||||||
result += formatTemplateOption(label) + '\n'
|
result += formatTemplateOption(label) + '\n'
|
||||||
}
|
}
|
||||||
|
@ -88,8 +53,8 @@ export function formatLabelOptionsForPRTemplate() {
|
||||||
export async function generateAutoRcFile() {
|
export async function generateAutoRcFile() {
|
||||||
const autoRcPath = join(REPO_ROOT, '.autorc')
|
const autoRcPath = join(REPO_ROOT, '.autorc')
|
||||||
await writeJsonFile(autoRcPath, {
|
await writeJsonFile(autoRcPath, {
|
||||||
plugins: ['npm'],
|
plugins: ['npm', '../scripts/lib/auto-plugin.js'],
|
||||||
labels: [...SCOPE_LABELS, ...TYPE_LABELS].map(({ name, changelogTitle }) => ({
|
labels: [...TYPE_LABELS.filter((l) => l.name !== 'other')].map(({ name, changelogTitle }) => ({
|
||||||
name,
|
name,
|
||||||
changelogTitle,
|
changelogTitle,
|
||||||
releaseType: 'none',
|
releaseType: 'none',
|
||||||
|
|
Loading…
Reference in a new issue