Revert "Fix issue when days-before-close is more than days-before-stale (#775)"
This reverts commit 2b58cc900f
.
This commit is contained in:
parent
33e37032bb
commit
8fb3645347
|
@ -720,12 +720,14 @@ class IssuesProcessor {
|
|||
const issueLogger = new issue_logger_1.IssueLogger(issue);
|
||||
const markedStaleOn = (yield this.getLabelCreationDate(issue, staleLabel)) || issue.updated_at;
|
||||
issueLogger.info(`$$type marked stale on: ${logger_service_1.LoggerService.cyan(markedStaleOn)}`);
|
||||
const issueHasCommentsSinceStale = yield this._hasCommentsSince(issue, markedStaleOn, staleMessage);
|
||||
issueLogger.info(`$$type has been commented on: ${logger_service_1.LoggerService.cyan(issueHasCommentsSinceStale)}`);
|
||||
const issueHasComments = yield this._hasCommentsSince(issue, markedStaleOn, staleMessage);
|
||||
issueLogger.info(`$$type has been commented on: ${logger_service_1.LoggerService.cyan(issueHasComments)}`);
|
||||
const daysBeforeClose = issue.isPullRequest
|
||||
? this._getDaysBeforePrClose()
|
||||
: this._getDaysBeforeIssueClose();
|
||||
issueLogger.info(`Days before $$type close: ${logger_service_1.LoggerService.cyan(daysBeforeClose)}`);
|
||||
const issueHasUpdate = IssuesProcessor._updatedSince(issue.updated_at, daysBeforeClose);
|
||||
issueLogger.info(`$$type has been updated: ${logger_service_1.LoggerService.cyan(issueHasUpdate)}`);
|
||||
const shouldRemoveStaleWhenUpdated = this._shouldRemoveStaleWhenUpdated(issue);
|
||||
issueLogger.info(`The option ${issueLogger.createOptionLink(this._getRemoveStaleWhenUpdatedUsedOptionName(issue))} is: ${logger_service_1.LoggerService.cyan(shouldRemoveStaleWhenUpdated)}`);
|
||||
if (shouldRemoveStaleWhenUpdated) {
|
||||
|
@ -737,11 +739,9 @@ class IssuesProcessor {
|
|||
if (issue.markedStaleThisRun) {
|
||||
issueLogger.info(`marked stale this run, so don't check for updates`);
|
||||
}
|
||||
const issueHasUpdateSinceStale = new Date(issue.updated_at) > new Date(markedStaleOn);
|
||||
issueLogger.info(`$$type has been updated since it was marked stale: ${logger_service_1.LoggerService.cyan(issueHasUpdateSinceStale)}`);
|
||||
// Should we un-stale this issue?
|
||||
if (shouldRemoveStaleWhenUpdated &&
|
||||
(issueHasUpdateSinceStale || issueHasCommentsSinceStale) &&
|
||||
(issueHasUpdate || issueHasComments) &&
|
||||
!issue.markedStaleThisRun) {
|
||||
issueLogger.info(`Remove the stale label since the $$type has been updated and the workflow should remove the stale label when updated`);
|
||||
yield this._removeStaleLabel(issue, staleLabel);
|
||||
|
@ -755,9 +755,7 @@ class IssuesProcessor {
|
|||
if (daysBeforeClose < 0) {
|
||||
return; // Nothing to do because we aren't closing stale issues
|
||||
}
|
||||
const issueHasUpdateInCloseWindow = IssuesProcessor._updatedSince(issue.updated_at, daysBeforeClose);
|
||||
issueLogger.info(`$$type has been updated in the last ${daysBeforeClose} days: ${logger_service_1.LoggerService.cyan(issueHasUpdateInCloseWindow)}`);
|
||||
if (!issueHasCommentsSinceStale && !issueHasUpdateInCloseWindow) {
|
||||
if (!issueHasComments && !issueHasUpdate) {
|
||||
issueLogger.info(`Closing $$type because it was last updated on: ${logger_service_1.LoggerService.cyan(issue.updated_at)}`);
|
||||
yield this._closeIssue(issue, closeMessage, closeLabel);
|
||||
if (this.options.deleteBranch && issue.pull_request) {
|
||||
|
@ -767,7 +765,7 @@ class IssuesProcessor {
|
|||
}
|
||||
}
|
||||
else {
|
||||
issueLogger.info(`Stale $$type is not old enough to close yet (hasComments? ${issueHasCommentsSinceStale}, hasUpdate? ${issueHasUpdateInCloseWindow})`);
|
||||
issueLogger.info(`Stale $$type is not old enough to close yet (hasComments? ${issueHasComments}, hasUpdate? ${issueHasUpdate})`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -625,15 +625,13 @@ export class IssuesProcessor {
|
|||
`$$type marked stale on: ${LoggerService.cyan(markedStaleOn)}`
|
||||
);
|
||||
|
||||
const issueHasCommentsSinceStale: boolean = await this._hasCommentsSince(
|
||||
const issueHasComments: boolean = await this._hasCommentsSince(
|
||||
issue,
|
||||
markedStaleOn,
|
||||
staleMessage
|
||||
);
|
||||
issueLogger.info(
|
||||
`$$type has been commented on: ${LoggerService.cyan(
|
||||
issueHasCommentsSinceStale
|
||||
)}`
|
||||
`$$type has been commented on: ${LoggerService.cyan(issueHasComments)}`
|
||||
);
|
||||
|
||||
const daysBeforeClose: number = issue.isPullRequest
|
||||
|
@ -644,6 +642,14 @@ export class IssuesProcessor {
|
|||
`Days before $$type close: ${LoggerService.cyan(daysBeforeClose)}`
|
||||
);
|
||||
|
||||
const issueHasUpdate: boolean = IssuesProcessor._updatedSince(
|
||||
issue.updated_at,
|
||||
daysBeforeClose
|
||||
);
|
||||
issueLogger.info(
|
||||
`$$type has been updated: ${LoggerService.cyan(issueHasUpdate)}`
|
||||
);
|
||||
|
||||
const shouldRemoveStaleWhenUpdated: boolean =
|
||||
this._shouldRemoveStaleWhenUpdated(issue);
|
||||
|
||||
|
@ -665,19 +671,10 @@ export class IssuesProcessor {
|
|||
issueLogger.info(`marked stale this run, so don't check for updates`);
|
||||
}
|
||||
|
||||
const issueHasUpdateSinceStale =
|
||||
new Date(issue.updated_at) > new Date(markedStaleOn);
|
||||
|
||||
issueLogger.info(
|
||||
`$$type has been updated since it was marked stale: ${LoggerService.cyan(
|
||||
issueHasUpdateSinceStale
|
||||
)}`
|
||||
);
|
||||
|
||||
// Should we un-stale this issue?
|
||||
if (
|
||||
shouldRemoveStaleWhenUpdated &&
|
||||
(issueHasUpdateSinceStale || issueHasCommentsSinceStale) &&
|
||||
(issueHasUpdate || issueHasComments) &&
|
||||
!issue.markedStaleThisRun
|
||||
) {
|
||||
issueLogger.info(
|
||||
|
@ -699,17 +696,7 @@ export class IssuesProcessor {
|
|||
return; // Nothing to do because we aren't closing stale issues
|
||||
}
|
||||
|
||||
const issueHasUpdateInCloseWindow: boolean = IssuesProcessor._updatedSince(
|
||||
issue.updated_at,
|
||||
daysBeforeClose
|
||||
);
|
||||
issueLogger.info(
|
||||
`$$type has been updated in the last ${daysBeforeClose} days: ${LoggerService.cyan(
|
||||
issueHasUpdateInCloseWindow
|
||||
)}`
|
||||
);
|
||||
|
||||
if (!issueHasCommentsSinceStale && !issueHasUpdateInCloseWindow) {
|
||||
if (!issueHasComments && !issueHasUpdate) {
|
||||
issueLogger.info(
|
||||
`Closing $$type because it was last updated on: ${LoggerService.cyan(
|
||||
issue.updated_at
|
||||
|
@ -728,7 +715,7 @@ export class IssuesProcessor {
|
|||
}
|
||||
} else {
|
||||
issueLogger.info(
|
||||
`Stale $$type is not old enough to close yet (hasComments? ${issueHasCommentsSinceStale}, hasUpdate? ${issueHasUpdateInCloseWindow})`
|
||||
`Stale $$type is not old enough to close yet (hasComments? ${issueHasComments}, hasUpdate? ${issueHasUpdate})`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue