mirror of
https://github.com/actions/stale.git
synced 2025-12-16 00:16:47 +00:00
Do not mutate state in debug mode
This commit is contained in:
9
dist/index.js
vendored
9
dist/index.js
vendored
@@ -1564,18 +1564,23 @@ const core = __importStar(__nccwpck_require__(2186));
|
||||
class State {
|
||||
constructor() {
|
||||
this.processedIssuesIDs = new Set();
|
||||
this.debug = core.getInput('debug-only') === 'true';
|
||||
}
|
||||
isIssueProcessed(issue) {
|
||||
return this.processedIssuesIDs.has(issue.number);
|
||||
}
|
||||
addIssueToProcessed(issue) {
|
||||
this.processedIssuesIDs.add(issue.number);
|
||||
if (!this.debug)
|
||||
this.processedIssuesIDs.add(issue.number);
|
||||
}
|
||||
reset() {
|
||||
this.processedIssuesIDs.clear();
|
||||
if (!this.debug)
|
||||
this.processedIssuesIDs.clear();
|
||||
}
|
||||
persist() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (this.debug)
|
||||
return;
|
||||
const serialized = Array.from(this.processedIssuesIDs).join('|');
|
||||
const tmpDir = os_1.default.tmpdir();
|
||||
const file = path_1.default.join(tmpDir, crypto_1.default.randomBytes(8).readBigUInt64LE(0).toString());
|
||||
|
||||
Reference in New Issue
Block a user