From 33c9eac656c55b913d43b393d1db348bdbfe4b4a Mon Sep 17 00:00:00 2001 From: Felix K <17876666+fkirc@users.noreply.github.com> Date: Fri, 2 Dec 2022 19:23:36 +0400 Subject: [PATCH] Increase robustness in case of GitHub API failures attempt to mitigate https://github.com/fkirc/skip-duplicate-actions/issues/301 --- src/main.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.ts b/src/main.ts index 835df57..388538a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -465,10 +465,18 @@ async function main(): Promise { const octokit = new Octokit(getOctokitOptions(token)) // Get and parse the current workflow run. + try { const {data: apiCurrentRun} = await octokit.rest.actions.getWorkflowRun({ ...repo, run_id: github.context.runId }) + } catch (error) { + core.warning(error) + await exitSuccess({ + shouldSkip: false, + reason: 'no_transferable_run' + }) + } const currentTreeHash = apiCurrentRun.head_commit?.tree_id if (!currentTreeHash) { exitFail(`