mirror of
https://github.com/actions/stale.git
synced 2025-12-28 11:08:18 +00:00
feat(close-label): automatically remove close-label when no longer closed nor locked (#334)
* feat(assignees): add new option to avoid stale for assignees closes #271 * test: add more coverage * docs: fix readme format issue * docs: reorder and enhance typo * docs(contributing): add more information about the npm scripts * docs(readme): update the default values to reflect the real applied ones * feat(close-label): automatically remove it when no longer closed nor locked closes #278
This commit is contained in:
committed by
GitHub
parent
ec96ff65b0
commit
836169b81a
@@ -140,6 +140,9 @@ export class IssuesProcessor {
|
||||
continue; // don't process locked issues
|
||||
}
|
||||
|
||||
// Try to remove the close label when not close/locked issue or PR
|
||||
await this._removeCloseLabel(issue, closeLabel);
|
||||
|
||||
if (this.options.startDate) {
|
||||
const startDate: Date = new Date(this.options.startDate);
|
||||
const createdAt: Date = new Date(issue.created_at);
|
||||
@@ -663,8 +666,35 @@ export class IssuesProcessor {
|
||||
): Promise<void> {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
|
||||
issueLogger.info(`$$type is no longer stale. Removing stale label.`);
|
||||
issueLogger.info(
|
||||
`The $$type is no longer stale. Removing the stale label...`
|
||||
);
|
||||
|
||||
return this._removeLabel(issue, staleLabel);
|
||||
}
|
||||
|
||||
private async _removeCloseLabel(
|
||||
issue: Issue,
|
||||
closeLabel: Readonly<string | undefined>
|
||||
): Promise<void> {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
|
||||
issueLogger.info(
|
||||
`The $$type is not closed nor locked. Trying to remove the close label...`
|
||||
);
|
||||
|
||||
if (!closeLabel) {
|
||||
issueLogger.info(`There is no close label on this $$type. Skip`);
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
if (isLabeled(issue, closeLabel)) {
|
||||
issueLogger.info(
|
||||
`The $$type has a close label "${closeLabel}". Removing the close label...`
|
||||
);
|
||||
|
||||
return this._removeLabel(issue, closeLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user