mirror of
https://github.com/actions/stale.git
synced 2025-12-11 12:37:27 +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
18
dist/index.js
vendored
18
dist/index.js
vendored
@@ -299,6 +299,8 @@ class IssuesProcessor {
|
||||
issueLogger.info(`Skipping $$type because it is locked`);
|
||||
continue; // don't process locked issues
|
||||
}
|
||||
// Try to remove the close label when not close/locked issue or PR
|
||||
yield this._removeCloseLabel(issue, closeLabel);
|
||||
if (this.options.startDate) {
|
||||
const startDate = new Date(this.options.startDate);
|
||||
const createdAt = new Date(issue.created_at);
|
||||
@@ -677,10 +679,24 @@ class IssuesProcessor {
|
||||
_removeStaleLabel(issue, staleLabel) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const issueLogger = new issue_logger_1.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);
|
||||
});
|
||||
}
|
||||
_removeCloseLabel(issue, closeLabel) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const issueLogger = new issue_logger_1.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 (is_labeled_1.isLabeled(issue, closeLabel)) {
|
||||
issueLogger.info(`The $$type has a close label "${closeLabel}". Removing the close label...`);
|
||||
return this._removeLabel(issue, closeLabel);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.IssuesProcessor = IssuesProcessor;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user