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

50
dist/index.js vendored
View File

@@ -580,28 +580,14 @@ class IssuesProcessor {
const shouldRemoveStaleWhenUpdated = this._shouldRemoveStaleWhenUpdated(issue);
issueLogger.info(`The option ${issueLogger.createOptionLink(this._getRemoveStaleWhenUpdatedUsedOptionName(issue))} is: ${logger_service_1.LoggerService.cyan(shouldRemoveStaleWhenUpdated)}`);
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 = this._shouldRemoveStaleWhenCommented(issue);
issueLogger.info(`The option ${issueLogger.createOptionLink(this._getRemoveStaleWhenCommentedUsedOptionName(issue))} is: ${logger_service_1.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`);
}
// Should we un-stale this issue?
if (shouldRemoveStaleWhenUpdated && issueHasUpdate) {
issueLogger.info(`Remove the stale label since the $$type has an update and the workflow should remove the stale label when updated`);
yield 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`);
if (shouldRemoveStaleWhenUpdated && issueHasComments) {
issueLogger.info(`Remove the stale label since the $$type has a comment and the workflow should remove the stale label when updated`);
yield this._removeStaleLabel(issue, staleLabel);
// Are there labels to remove or add when an issue is no longer stale?
yield this._removeLabelsWhenUnstale(issue, labelsToRemoveWhenUnstale);
@@ -916,18 +902,6 @@ class IssuesProcessor {
}
});
}
_shouldRemoveStaleWhenCommented(issue) {
if (issue.isPullRequest) {
if (is_boolean_1.isBoolean(this.options.removePrStaleWhenCommented)) {
return this.options.removePrStaleWhenCommented;
}
return this.options.removeStaleWhenCommented;
}
if (is_boolean_1.isBoolean(this.options.removeIssueStaleWhenCommented)) {
return this.options.removeIssueStaleWhenCommented;
}
return this.options.removeStaleWhenCommented;
}
_removeStaleLabel(issue, staleLabel) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
@@ -989,18 +963,6 @@ class IssuesProcessor {
}
return option_1.Option.RemoveStaleWhenUpdated;
}
_getRemoveStaleWhenCommentedUsedOptionName(issue) {
if (issue.isPullRequest) {
if (is_boolean_1.isBoolean(this.options.removePrStaleWhenCommented)) {
return option_1.Option.RemovePrStaleWhenCommented;
}
return option_1.Option.RemoveStaleWhenCommented;
}
if (is_boolean_1.isBoolean(this.options.removeIssueStaleWhenCommented)) {
return option_1.Option.RemoveIssueStaleWhenCommented;
}
return option_1.Option.RemoveStaleWhenCommented;
}
}
exports.IssuesProcessor = IssuesProcessor;
@@ -1761,9 +1723,6 @@ var Option;
Option["RemoveStaleWhenUpdated"] = "remove-stale-when-updated";
Option["RemoveIssueStaleWhenUpdated"] = "remove-issue-stale-when-updated";
Option["RemovePrStaleWhenUpdated"] = "remove-pr-stale-when-updated";
Option["RemoveStaleWhenCommented"] = "remove-stale-when-commented";
Option["RemoveIssueStaleWhenCommented"] = "remove-issue-stale-when-commented";
Option["RemovePrStaleWhenCommented"] = "remove-pr-stale-when-commented";
Option["DebugOnly"] = "debug-only";
Option["Ascending"] = "ascending";
Option["DeleteBranch"] = "delete-branch";
@@ -2048,9 +2007,6 @@ function _getAndValidateArgs() {
removeStaleWhenUpdated: !(core.getInput('remove-stale-when-updated') === 'false'),
removeIssueStaleWhenUpdated: _toOptionalBoolean(core.getInput('remove-issue-stale-when-updated')),
removePrStaleWhenUpdated: _toOptionalBoolean(core.getInput('remove-pr-stale-when-updated')),
removeStaleWhenCommented: !(core.getInput('remove-stale-when-commented') === 'false'),
removeIssueStaleWhenCommented: _toOptionalBoolean(core.getInput('remove-issue-stale-when-commented')),
removePrStaleWhenCommented: _toOptionalBoolean(core.getInput('remove-pr-stale-when-commented')),
debugOnly: core.getInput('debug-only') === 'true',
ascending: core.getInput('ascending') === 'true',
deleteBranch: core.getInput('delete-branch') === 'true',