Skip to content

Commit

Permalink
(actions#1135) issues-processor: ignore comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed Feb 21, 2024
1 parent 3f3b017 commit ff1ceeb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
18 changes: 13 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,16 @@ 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 issueHasCommentsSinceStale: boolean = await this._hasCommentsSince(
// issue,
// markedStaleOn,
// staleMessage
// );
// issueLogger.info(
// `$$type has been commented on: ${LoggerService.cyan(
// issueHasCommentsSinceStale
// )}`
// );
const daysBeforeClose = issue.isPullRequest
? this._getDaysBeforePrClose()
: this._getDaysBeforeIssueClose();
Expand All @@ -781,7 +789,7 @@ class IssuesProcessor {
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) &&
issueHasUpdateSinceStale &&
!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);
Expand All @@ -797,7 +805,7 @@ class IssuesProcessor {
}
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 (!issueHasUpdateInCloseWindow) {
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) {
Expand All @@ -807,7 +815,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 (hasUpdate? ${issueHasUpdateInCloseWindow})`);
}
});
}
Expand Down
26 changes: 13 additions & 13 deletions src/classes/issues-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,16 +667,16 @@ export class IssuesProcessor {
`$$type marked stale on: ${LoggerService.cyan(markedStaleOn)}`
);

const issueHasCommentsSinceStale: boolean = await this._hasCommentsSince(
issue,
markedStaleOn,
staleMessage
);
issueLogger.info(
`$$type has been commented on: ${LoggerService.cyan(
issueHasCommentsSinceStale
)}`
);
// const issueHasCommentsSinceStale: boolean = await this._hasCommentsSince(
// issue,
// markedStaleOn,
// staleMessage
// );
// issueLogger.info(
// `$$type has been commented on: ${LoggerService.cyan(
// issueHasCommentsSinceStale
// )}`
// );

const daysBeforeClose: number = issue.isPullRequest
? this._getDaysBeforePrClose()
Expand Down Expand Up @@ -729,7 +729,7 @@ export class IssuesProcessor {
// Should we un-stale this issue?
if (
shouldRemoveStaleWhenUpdated &&
(issueHasUpdateSinceStale || issueHasCommentsSinceStale) &&
issueHasUpdateSinceStale &&
!issue.markedStaleThisRun
) {
issueLogger.info(
Expand Down Expand Up @@ -765,7 +765,7 @@ export class IssuesProcessor {
)}`
);

if (!issueHasCommentsSinceStale && !issueHasUpdateInCloseWindow) {
if (!issueHasUpdateInCloseWindow) {
issueLogger.info(
`Closing $$type because it was last updated on: ${LoggerService.cyan(
issue.updated_at
Expand All @@ -784,7 +784,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 (hasUpdate? ${issueHasUpdateInCloseWindow})`
);
}
}
Expand Down

0 comments on commit ff1ceeb

Please sign in to comment.