8000 fix: remove API labels if exclude labels added by codebytere · Pull Request #72 · electron/cation · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: remove API labels if exclude labels added #72

New issue
Merged
merged 1 commit into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/api-review-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
API_REVIEW_CHECK_NAME,
API_WORKING_GROUP,
EXCLUDE_LABELS,
MASTER_BRANCH,
MINIMUM_MINOR_OPEN_TIME,
MINIMUM_PATCH_OPEN_TIME,
NEW_PR_LABEL,
Expand Down Expand Up @@ -340,7 +341,8 @@ export function setupAPIReviewStateManagement(probot: Probot) {
}

const isSemverMajorMinor = [SEMVER_LABELS.MINOR, SEMVER_LABELS.MAJOR].includes(label.name);
const shouldExclude = pr.labels.some(l => EXCLUDE_LABELS.includes(l.name));
const shouldExclude =
pr.labels.some(l => EXCLUDE_LABELS.includes(l.name)) || pr.base.ref !== MASTER_BRANCH;

// If a PR is semver-minor or semver-major and the PR does not have an
// exclusion label, automatically add the 'api-review/requested 🗳' label.
Expand Down Expand Up @@ -370,6 +372,14 @@ export function setupAPIReviewStateManagement(probot: Probot) {
});
return;
}
} else if (shouldExclude) {
// Remove the api-review/requested label if it was added prior to an exclusion label -
// for example if the backport label was added by trop after cation got to it.
await removeLabel(context.octokit, {
...context.repo({}),
prNumber: pr.number,
name: REVIEW_LABELS.REQUESTED,
});
}

await addOrUpdateAPIReviewCheck(context.octokit, pr);
Expand Down
2 changes: 2 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export const BACKPORT_LABEL = 'backport';
export const BACKPORT_SKIP_LABEL = 'backport-check-skip';
export const FAST_TRACK_LABEL = 'fast-track 🚅';

export const MASTER_BRANCH = 'master';

export const SEMVER_NONE_LABEL = 'semver/none';
export const SEMVER_LABELS = {
PATCH: 'semver/patch',
Expand Down
0