feat(dev-infra): support for caretaker note label in merge script (#37595)

Adds support for a caretaker note label to the merge script.
Whenever a configured label is applied, the merge script will
not merge automatically, but instead prompt first in order
to ensure that the caretaker paid attention to the manual
caretaker note on the PR. This helps if a PR needs special
attention.

PR Close #37595
This commit is contained in:
Paul Gschwendtner
2020-06-16 00:20:36 +02:00
committed by Misko Hevery
parent f5e39999d7
commit 8154bbd538
5 changed files with 41 additions and 2 deletions

View File

@ -17,6 +17,8 @@ import {PullRequestMergeTask} from './task';
/** Interface that describes a pull request. */
export interface PullRequest {
/** URL to the pull request. */
url: string;
/** Number of the pull request. */
prNumber: number;
/** Title of the pull request. */
@ -33,6 +35,8 @@ export interface PullRequest {
requiredBaseSha?: string;
/** Whether the pull request commit message fixup. */
needsCommitMessageFixup: boolean;
/** Whether the pull request has a caretaker note. */
hasCaretakerNote: boolean;
}
/**
@ -77,13 +81,17 @@ export async function loadAndValidatePullRequest(
config.requiredBaseCommits && config.requiredBaseCommits[githubTargetBranch];
const needsCommitMessageFixup = !!config.commitMessageFixupLabel &&
labels.some(name => matchesPattern(name, config.commitMessageFixupLabel));
const hasCaretakerNote = !!config.caretakerNoteLabel &&
labels.some(name => matchesPattern(name, config.caretakerNoteLabel!));
return {
url: prData.html_url,
prNumber,
labels,
requiredBaseSha,
githubTargetBranch,
needsCommitMessageFixup,
hasCaretakerNote,
title: prData.title,
targetBranches: getBranchesFromTargetLabel(targetLabel, githubTargetBranch),
commitCount: prData.commits,