Revert "feat(options): add new options to avoid stale base on comments (#494)" (#507)

This reverts commit 1efddcbe9f.
This commit is contained in:
Geoffrey Testelin
2021-06-15 23:16:31 +02:00
committed by GitHub
parent f2ae27a59b
commit d3bfc50685
12 changed files with 79 additions and 827 deletions

View File

@@ -616,28 +616,7 @@ export class IssuesProcessor {
);
if (shouldRemoveStaleWhenUpdated) {
issueLogger.info(
`The stale label should not be removed due to an update`
);
} else {
issueLogger.info(
`The stale label should be removed if all conditions met`
);
}
const shouldRemoveStaleWhenCommented: boolean =
this._shouldRemoveStaleWhenCommented(issue);
issueLogger.info(
`The option ${issueLogger.createOptionLink(
this._getRemoveStaleWhenCommentedUsedOptionName(issue)
)} is: ${LoggerService.cyan(shouldRemoveStaleWhenCommented)}`
);
if (shouldRemoveStaleWhenCommented) {
issueLogger.info(
`The stale label should not be removed due to a comment`
);
issueLogger.info(`The stale label should not be removed`);
} else {
issueLogger.info(
`The stale label should be removed if all conditions met`
@@ -645,18 +624,9 @@ export class IssuesProcessor {
}
// Should we un-stale this issue?
if (shouldRemoveStaleWhenUpdated && issueHasUpdate) {
if (shouldRemoveStaleWhenUpdated && issueHasComments) {
issueLogger.info(
`Remove the stale label since the $$type has an update and the workflow should remove the stale label when updated`
);
await this._removeStaleLabel(issue, staleLabel);
issueLogger.info(`Skipping the process since the $$type is now un-stale`);
return; // Nothing to do because it is no longer stale
} else if (shouldRemoveStaleWhenCommented && issueHasComments) {
issueLogger.info(
`Remove the stale label since the $$type has a comment and the workflow should remove the stale label when commented`
`Remove the stale label since the $$type has a comment and the workflow should remove the stale label when updated`
);
await this._removeStaleLabel(issue, staleLabel);
@@ -1076,22 +1046,6 @@ export class IssuesProcessor {
}
}
private _shouldRemoveStaleWhenCommented(issue: Issue): boolean {
if (issue.isPullRequest) {
if (isBoolean(this.options.removePrStaleWhenCommented)) {
return this.options.removePrStaleWhenCommented;
}
return this.options.removeStaleWhenCommented;
}
if (isBoolean(this.options.removeIssueStaleWhenCommented)) {
return this.options.removeIssueStaleWhenCommented;
}
return this.options.removeStaleWhenCommented;
}
private async _removeStaleLabel(
issue: Issue,
staleLabel: Readonly<string>
@@ -1203,25 +1157,4 @@ export class IssuesProcessor {
return Option.RemoveStaleWhenUpdated;
}
private _getRemoveStaleWhenCommentedUsedOptionName(
issue: Readonly<Issue>
):
| Option.RemovePrStaleWhenCommented
| Option.RemoveStaleWhenCommented
| Option.RemoveIssueStaleWhenCommented {
if (issue.isPullRequest) {
if (isBoolean(this.options.removePrStaleWhenCommented)) {
return Option.RemovePrStaleWhenCommented;
}
return Option.RemoveStaleWhenCommented;
}
if (isBoolean(this.options.removeIssueStaleWhenCommented)) {
return Option.RemoveIssueStaleWhenCommented;
}
return Option.RemoveStaleWhenCommented;
}
}