Merge bf388bf594a023da9f3bd70afc17d2671ff94dda into 3f3b0175e8c66fb49b9a6d5a0cd1f8436d4c3ab6
This commit is contained in:
commit
098fbeb742
17
dist/index.js
vendored
17
dist/index.js
vendored
@ -288,7 +288,6 @@ class Issue {
|
||||
this.milestone = issue.milestone;
|
||||
this.assignees = issue.assignees || [];
|
||||
this.isStale = (0, is_labeled_1.isLabeled)(this, this.staleLabel);
|
||||
this.markedStaleThisRun = false;
|
||||
}
|
||||
get isPullRequest() {
|
||||
return (0, is_pull_request_1.isPullRequest)(this);
|
||||
@ -626,8 +625,8 @@ class IssuesProcessor {
|
||||
issueLogger.info(`This $$type should be marked as stale based on the option ${issueLogger.createOptionLink(this._getDaysBeforeStaleUsedOptionName(issue))} (${logger_service_1.LoggerService.cyan(daysBeforeStale)})`);
|
||||
yield this._markStale(issue, staleMessage, staleLabel, skipMessage);
|
||||
issue.isStale = true; // This issue is now considered stale
|
||||
issue.markedStaleThisRun = true;
|
||||
issueLogger.info(`This $$type is now stale`);
|
||||
yield this._removeLabelsOnStatusTransition(issue, labelsToRemoveWhenStale, option_1.Option.LabelsToRemoveWhenStale);
|
||||
}
|
||||
else {
|
||||
issueLogger.info(`This $$type should not be marked as stale based on the option ${issueLogger.createOptionLink(this._getDaysBeforeStaleUsedOptionName(issue))} (${logger_service_1.LoggerService.cyan(daysBeforeStale)})`);
|
||||
@ -642,10 +641,9 @@ class IssuesProcessor {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Process the issue if it was marked stale
|
||||
if (issue.isStale) {
|
||||
else {
|
||||
issueLogger.info(`This $$type is already stale`);
|
||||
yield this._processStaleIssue(issue, staleLabel, staleMessage, labelsToAddWhenUnstale, labelsToRemoveWhenUnstale, labelsToRemoveWhenStale, closeMessage, closeLabel);
|
||||
yield this._processStaleIssue(issue, staleLabel, staleMessage, labelsToAddWhenUnstale, labelsToRemoveWhenUnstale, closeMessage, closeLabel);
|
||||
}
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
});
|
||||
@ -752,7 +750,7 @@ class IssuesProcessor {
|
||||
});
|
||||
}
|
||||
// handle all of the stale issue logic when we find a stale issue
|
||||
_processStaleIssue(issue, staleLabel, staleMessage, labelsToAddWhenUnstale, labelsToRemoveWhenUnstale, labelsToRemoveWhenStale, closeMessage, closeLabel) {
|
||||
_processStaleIssue(issue, staleLabel, staleMessage, labelsToAddWhenUnstale, labelsToRemoveWhenUnstale, closeMessage, closeLabel) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const issueLogger = new issue_logger_1.IssueLogger(issue);
|
||||
const markedStaleOn = (yield this.getLabelCreationDate(issue, staleLabel)) || issue.updated_at;
|
||||
@ -771,18 +769,13 @@ class IssuesProcessor {
|
||||
else {
|
||||
issueLogger.info(`The stale label should be removed if all conditions met`);
|
||||
}
|
||||
if (issue.markedStaleThisRun) {
|
||||
issueLogger.info(`marked stale this run, so don't check for updates`);
|
||||
yield this._removeLabelsOnStatusTransition(issue, labelsToRemoveWhenStale, option_1.Option.LabelsToRemoveWhenStale);
|
||||
}
|
||||
// The issue.updated_at and markedStaleOn are not always exactly in sync (they can be off by a second or 2)
|
||||
// isDateMoreRecentThan makes sure they are not the same date within a certain tolerance (15 seconds in this case)
|
||||
const issueHasUpdateSinceStale = (0, is_date_more_recent_than_1.isDateMoreRecentThan)(new Date(issue.updated_at), new Date(markedStaleOn), 15);
|
||||
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) &&
|
||||
!issue.markedStaleThisRun) {
|
||||
(issueHasUpdateSinceStale || issueHasCommentsSinceStale)) {
|
||||
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);
|
||||
// Are there labels to remove or add when an issue is no longer stale?
|
||||
|
||||
@ -21,7 +21,6 @@ export class Issue implements IIssue {
|
||||
readonly milestone?: IMilestone | null;
|
||||
readonly assignees: Assignee[];
|
||||
isStale: boolean;
|
||||
markedStaleThisRun: boolean;
|
||||
operations = new Operations();
|
||||
private readonly _options: IIssuesProcessorOptions;
|
||||
|
||||
@ -42,7 +41,6 @@ export class Issue implements IIssue {
|
||||
this.milestone = issue.milestone;
|
||||
this.assignees = issue.assignees || [];
|
||||
this.isStale = isLabeled(this, this.staleLabel);
|
||||
this.markedStaleThisRun = false;
|
||||
}
|
||||
|
||||
get isPullRequest(): boolean {
|
||||
|
||||
@ -495,8 +495,13 @@ export class IssuesProcessor {
|
||||
);
|
||||
await this._markStale(issue, staleMessage, staleLabel, skipMessage);
|
||||
issue.isStale = true; // This issue is now considered stale
|
||||
issue.markedStaleThisRun = true;
|
||||
issueLogger.info(`This $$type is now stale`);
|
||||
|
||||
await this._removeLabelsOnStatusTransition(
|
||||
issue,
|
||||
labelsToRemoveWhenStale,
|
||||
Option.LabelsToRemoveWhenStale
|
||||
);
|
||||
} else {
|
||||
issueLogger.info(
|
||||
`This $$type should not be marked as stale based on the option ${issueLogger.createOptionLink(
|
||||
@ -519,10 +524,7 @@ export class IssuesProcessor {
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Process the issue if it was marked stale
|
||||
if (issue.isStale) {
|
||||
} else {
|
||||
issueLogger.info(`This $$type is already stale`);
|
||||
await this._processStaleIssue(
|
||||
issue,
|
||||
@ -530,7 +532,6 @@ export class IssuesProcessor {
|
||||
staleMessage,
|
||||
labelsToAddWhenUnstale,
|
||||
labelsToRemoveWhenUnstale,
|
||||
labelsToRemoveWhenStale,
|
||||
closeMessage,
|
||||
closeLabel
|
||||
);
|
||||
@ -656,7 +657,6 @@ export class IssuesProcessor {
|
||||
staleMessage: string,
|
||||
labelsToAddWhenUnstale: Readonly<string>[],
|
||||
labelsToRemoveWhenUnstale: Readonly<string>[],
|
||||
labelsToRemoveWhenStale: Readonly<string>[],
|
||||
closeMessage?: string,
|
||||
closeLabel?: string
|
||||
) {
|
||||
@ -703,15 +703,6 @@ export class IssuesProcessor {
|
||||
);
|
||||
}
|
||||
|
||||
if (issue.markedStaleThisRun) {
|
||||
issueLogger.info(`marked stale this run, so don't check for updates`);
|
||||
await this._removeLabelsOnStatusTransition(
|
||||
issue,
|
||||
labelsToRemoveWhenStale,
|
||||
Option.LabelsToRemoveWhenStale
|
||||
);
|
||||
}
|
||||
|
||||
// The issue.updated_at and markedStaleOn are not always exactly in sync (they can be off by a second or 2)
|
||||
// isDateMoreRecentThan makes sure they are not the same date within a certain tolerance (15 seconds in this case)
|
||||
const issueHasUpdateSinceStale = isDateMoreRecentThan(
|
||||
@ -729,8 +720,7 @@ export class IssuesProcessor {
|
||||
// Should we un-stale this issue?
|
||||
if (
|
||||
shouldRemoveStaleWhenUpdated &&
|
||||
(issueHasUpdateSinceStale || issueHasCommentsSinceStale) &&
|
||||
!issue.markedStaleThisRun
|
||||
(issueHasUpdateSinceStale || issueHasCommentsSinceStale)
|
||||
) {
|
||||
issueLogger.info(
|
||||
`Remove the stale label since the $$type has been updated and the workflow should remove the stale label when updated`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user