diff --git a/dist/index.js b/dist/index.js index f8a26f3..6916e3b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -334,7 +334,18 @@ function main() { const repo = github.context.repo; const octokit = new Octokit((0, utils_1.getOctokitOptions)(token)); // Get and parse the current workflow run. - const { data: apiCurrentRun } = yield octokit.rest.actions.getWorkflowRun(Object.assign(Object.assign({}, repo), { run_id: github.context.runId })); + let apiCurrentRun = null; + try { + const res = yield octokit.rest.actions.getWorkflowRun(Object.assign(Object.assign({}, repo), { run_id: github.context.runId })); + apiCurrentRun = res.data; + } + catch (error) { + core.warning(error); + yield exitSuccess({ + shouldSkip: false, + reason: 'no_transferable_run' + }); + } const currentTreeHash = (_a = apiCurrentRun.head_commit) === null || _a === void 0 ? void 0 : _a.tree_id; if (!currentTreeHash) { exitFail(` diff --git a/src/main.ts b/src/main.ts index 835df57..b012c7e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -465,10 +465,20 @@ async function main(): Promise { const octokit = new Octokit(getOctokitOptions(token)) // Get and parse the current workflow run. - const {data: apiCurrentRun} = await octokit.rest.actions.getWorkflowRun({ - ...repo, - run_id: github.context.runId - }) + let apiCurrentRun: ApiWorkflowRun = null as unknown as ApiWorkflowRun + try { + const res = await octokit.rest.actions.getWorkflowRun({ + ...repo, + run_id: github.context.runId + }) + apiCurrentRun = res.data + } catch (error) { + core.warning(error as string | Error) + await exitSuccess({ + shouldSkip: false, + reason: 'no_transferable_run' + }) + } const currentTreeHash = apiCurrentRun.head_commit?.tree_id if (!currentTreeHash) { exitFail(`