Revert "Fix issue when days-before-close is more than days-before-stale (#775)"

This reverts commit 2b58cc900f.
This commit is contained in:
paralarımı çaldınız hepinizin anasını sikeyyiiim 2022-09-09 18:03:37 +03:00 committed by GitHub
parent 33e37032bb
commit 8fb3645347
2 changed files with 20 additions and 35 deletions

16
dist/index.js vendored
View File

@ -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})`);
}
});
}

View File

@ -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})`
);
}
}