feat: remove the only-labels option

BREAKING CHANGE:
The option only-labels was removed
This commit is contained in:
TESTELIN Geoffrey
2021-10-08 20:26:58 +02:00
parent 1c81c38e2f
commit a8c5bb1c29
9 changed files with 568 additions and 1205 deletions

View File

@@ -27,7 +27,6 @@ describe('Issue', (): void => {
deleteBranch: false,
exemptIssueLabels: '',
exemptPrLabels: '',
onlyLabels: '',
onlyIssueLabels: '',
onlyPrLabels: '',
anyOfIssueLabels: '',

View File

@@ -3,29 +3,29 @@ import {context, getOctokit} from '@actions/github';
import {GitHub} from '@actions/github/lib/utils';
import {GetResponseTypeFromEndpointMethod} from '@octokit/types';
import {Option} from '../enums/option';
import {cleanLabel} from '../functions/clean-label';
import {getHumanizedDate} from '../functions/dates/get-humanized-date';
import {isDateMoreRecentThan} from '../functions/dates/is-date-more-recent-than';
import {isValidDate} from '../functions/dates/is-valid-date';
import {isBoolean} from '../functions/is-boolean';
import {isLabeled} from '../functions/is-labeled';
import {cleanLabel} from '../functions/clean-label';
import {shouldMarkWhenStale} from '../functions/should-mark-when-stale';
import {wordsToList} from '../functions/words-to-list';
import {IComment} from '../interfaces/comment';
import {IIssue} from '../interfaces/issue';
import {IIssueEvent} from '../interfaces/issue-event';
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
import {IPullRequest} from '../interfaces/pull-request';
import {LoggerService} from '../services/logger.service';
import {Assignees} from './assignees';
import {IgnoreUpdates} from './ignore-updates';
import {ExemptDraftPullRequest} from './exempt-draft-pull-request';
import {IgnoreUpdates} from './ignore-updates';
import {Issue} from './issue';
import {IssueLogger} from './loggers/issue-logger';
import {Logger} from './loggers/logger';
import {Milestones} from './milestones';
import {StaleOperations} from './stale-operations';
import {Statistics} from './statistics';
import {LoggerService} from '../services/logger.service';
import {IIssue} from '../interfaces/issue';
/***
* Handle processing of issues for staleness/closure.
@@ -227,7 +227,7 @@ export class IssuesProcessor {
if (onlyLabels.length > 0) {
issueLogger.info(
`The option ${issueLogger.createOptionLink(
Option.OnlyLabels
issue.isPullRequest ? Option.OnlyPrLabels : Option.OnlyIssueLabels
)} was specified to only process issues and pull requests with all those labels (${LoggerService.cyan(
onlyLabels.length
)})`
@@ -260,7 +260,7 @@ export class IssuesProcessor {
} else {
issueLogger.info(
`The option ${issueLogger.createOptionLink(
Option.OnlyLabels
issue.isPullRequest ? Option.OnlyPrLabels : Option.OnlyIssueLabels
)} was not specified`
);
issueLogger.info(
@@ -983,16 +983,10 @@ export class IssuesProcessor {
private _getOnlyLabels(issue: Issue): string {
if (issue.isPullRequest) {
if (this.options.onlyPrLabels !== '') {
return this.options.onlyPrLabels;
}
} else {
if (this.options.onlyIssueLabels !== '') {
return this.options.onlyIssueLabels;
}
return this.options.onlyPrLabels;
}
return this.options.onlyLabels;
return this.options.onlyIssueLabels;
}
private _getAnyOfLabels(issue: Issue): string {

View File

@@ -16,7 +16,6 @@ export enum Option {
StalePrLabel = 'stale-pr-label',
ClosePrLabel = 'close-pr-label',
ExemptPrLabels = 'exempt-pr-labels',
OnlyLabels = 'only-labels',
OnlyIssueLabels = 'only-issue-labels',
OnlyPrLabels = 'only-pr-labels',
AnyOfIssueLabels = 'any-of-issue-labels',

View File

@@ -18,7 +18,6 @@ export interface IIssuesProcessorOptions {
stalePrLabel: string;
closePrLabel: string;
exemptPrLabels: string;
onlyLabels: string;
onlyIssueLabels: string;
onlyPrLabels: string;
anyOfIssueLabels: string;

View File

@@ -44,7 +44,6 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
stalePrLabel: core.getInput('stale-pr-label', {required: true}),
closePrLabel: core.getInput('close-pr-label'),
exemptPrLabels: core.getInput('exempt-pr-labels'),
onlyLabels: core.getInput('only-labels'),
onlyIssueLabels: core.getInput('only-issue-labels'),
onlyPrLabels: core.getInput('only-pr-labels'),
anyOfIssueLabels: core.getInput('any-of-issue-labels'),