release-tool: auto create backport label on branch cut (#49739)

This commit is contained in:
coury-clark 2023-03-21 11:33:49 -07:00 committed by GitHub
parent ead9e530e2
commit ccd331db95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -383,6 +383,7 @@ ${trackingIssues.map(index => `- ${slackURL(index.title, index.url)}`).join('\n'
description: 'Create release branch',
run: async config => {
const release = await getActiveRelease(config)
const client = await getAuthenticatedGitHubClient()
let message: string
// notify cs team on patch release cut
if (release.version.patch !== 0) {
@ -399,6 +400,25 @@ ${trackingIssues.map(index => `- ${slackURL(index.title, index.url)}`).join('\n'
} catch (error) {
console.error('Failed to create release branch', error)
}
if (release.version.patch === 0) {
// create backport label for major / minor versions
const params = {
owner: 'sourcegraph',
repo: 'sourcegraph',
}
const labelName = `backport ${release.version.major}.${release.version.minor}`
const labelExists = await client.issues
.getLabel({ name: labelName, ...params })
.then(resp => resp.status === 200)
.catch(() => false)
if (!labelExists) {
console.log(await client.issues.createLabel({ name: labelName, color: 'e69138', ...params }))
console.log(`Label ${labelName} created`)
} else {
console.log(`label ${labelName} already exists`)
}
}
},
},
{