diff --git a/github-actions/lock-closed/lib/main.ts b/github-actions/lock-closed/lib/main.ts index 2ae1c7d51..6dbf0283c 100644 --- a/github-actions/lock-closed/lib/main.ts +++ b/github-actions/lock-closed/lib/main.ts @@ -2,6 +2,7 @@ import * as core from '@actions/core'; import {context} from '@actions/github'; import {Octokit} from '@octokit/rest'; import {ANGULAR_LOCK_BOT, getAuthTokenFor, revokeActiveInstallationToken} from '../../utils.js'; +import {setTimeout as setTimeoutPromise} from 'timers/promises'; async function lockIssue( client: Octokit, @@ -24,11 +25,6 @@ async function lockIssue( }); } -/** Creates a promise which resolves after a set period of time. */ -function timeout(ms: number) { - return setTimeout.__promisify__(ms); -} - async function main() { const reposToBeChecked = core.getMultilineInput('repos', {required: true, trimWhitespace: true}); await core.group('Repos being checked for lockable issues:', async () => @@ -101,7 +97,7 @@ async function runLockClosedAction(github: Octokit, repo: string): Promise } console.info(`Locking ${itemType} #${item.number}`); await lockIssue(github, item.number, repo, message); - await timeout(250); + await setTimeoutPromise(250); ++lockCount; } catch (error: any) { // TODO(josephperrott): properly set typings for error. diff --git a/github-actions/lock-closed/main.js b/github-actions/lock-closed/main.js index c5ac73ef5..6eaf64525 100644 --- a/github-actions/lock-closed/main.js +++ b/github-actions/lock-closed/main.js @@ -8326,7 +8326,7 @@ var require_lib4 = __commonJS({ var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref$size = _ref.size; let size = _ref$size === void 0 ? 0 : _ref$size; var _ref$timeout = _ref.timeout; - let timeout2 = _ref$timeout === void 0 ? 0 : _ref$timeout; + let timeout = _ref$timeout === void 0 ? 0 : _ref$timeout; if (body == null) { body = null; } else if (isURLSearchParams(body)) { @@ -8350,7 +8350,7 @@ var require_lib4 = __commonJS({ error: null }; this.size = size; - this.timeout = timeout2; + this.timeout = timeout; if (body instanceof Stream) { body.on("error", function(err) { const error2 = err.name === "AbortError" ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, "system", err); @@ -13220,7 +13220,7 @@ var require_lib6 = __commonJS({ var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref$size = _ref.size; let size = _ref$size === void 0 ? 0 : _ref$size; var _ref$timeout = _ref.timeout; - let timeout2 = _ref$timeout === void 0 ? 0 : _ref$timeout; + let timeout = _ref$timeout === void 0 ? 0 : _ref$timeout; if (body == null) { body = null; } else if (isURLSearchParams(body)) { @@ -13244,7 +13244,7 @@ var require_lib6 = __commonJS({ error: null }; this.size = size; - this.timeout = timeout2; + this.timeout = timeout; if (body instanceof Stream) { body.on("error", function(err) { const error2 = err.name === "AbortError" ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, "system", err); @@ -17609,7 +17609,7 @@ var require_lib8 = __commonJS({ var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref$size = _ref.size; let size = _ref$size === void 0 ? 0 : _ref$size; var _ref$timeout = _ref.timeout; - let timeout2 = _ref$timeout === void 0 ? 0 : _ref$timeout; + let timeout = _ref$timeout === void 0 ? 0 : _ref$timeout; if (body == null) { body = null; } else if (isURLSearchParams(body)) { @@ -17633,7 +17633,7 @@ var require_lib8 = __commonJS({ error: null }; this.size = size; - this.timeout = timeout2; + this.timeout = timeout; if (body instanceof Stream) { body.on("error", function(err) { const error2 = err.name === "AbortError" ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, "system", err); @@ -23471,6 +23471,7 @@ async function revokeActiveInstallationToken(githubOrToken) { } // +import { setTimeout as setTimeoutPromise } from "timers/promises"; async function lockIssue(client, issue, repo, message) { await client.issues.createComment({ repo, @@ -23484,9 +23485,6 @@ async function lockIssue(client, issue, repo, message) { issue_number: issue }); } -function timeout(ms) { - return setTimeout.__promisify__(ms); -} async function main() { const reposToBeChecked = core.getMultilineInput("repos", { required: true, trimWhitespace: true }); await core.group("Repos being checked for lockable issues:", async () => reposToBeChecked.forEach((repo) => core.info(`- ${repo}`))); @@ -23542,7 +23540,7 @@ Read more about our [automatic conversation locking policy](${policyUrl}). } console.info(`Locking ${itemType} #${item.number}`); await lockIssue(github, item.number, repo, message); - await timeout(250); + await setTimeoutPromise(250); ++lockCount; } catch (error2) { core.debug(error2);