From 103d603774ad21f9b09d4e87e8fc1b055f706bc6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2026 06:14:57 +0000 Subject: [PATCH] refactor: use getErrorMessage helper in extra_empty_commit.cjs Replace inline `error instanceof Error ? error.message : String(error)` with the existing `getErrorMessage` utility from error_helpers.cjs, consistent with the pattern used throughout the codebase. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- actions/setup/js/extra_empty_commit.cjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/actions/setup/js/extra_empty_commit.cjs b/actions/setup/js/extra_empty_commit.cjs index 33a38e8797..ddb88e133f 100644 --- a/actions/setup/js/extra_empty_commit.cjs +++ b/actions/setup/js/extra_empty_commit.cjs @@ -2,6 +2,7 @@ /// const { validateTargetRepo, parseAllowedRepos, getDefaultTargetRepo } = require("./repo_helpers.cjs"); +const { getErrorMessage } = require("./error_helpers.cjs"); /** * @fileoverview Extra Empty Commit Helper @@ -150,7 +151,7 @@ async function pushExtraEmptyCommit({ branchName, repoOwner, repoName, commitMes } catch (error) { // Non-fatal: if fetch/reset fails (e.g. branch not yet on remote), continue // with the local HEAD and attempt the push anyway. - const syncErrorMessage = error instanceof Error ? error.message : String(error); + const syncErrorMessage = getErrorMessage(error); core.warning(`Could not sync local branch with remote ${branchName} - will attempt push with local HEAD. Underlying error: ${syncErrorMessage}`); } @@ -170,7 +171,7 @@ async function pushExtraEmptyCommit({ branchName, repoOwner, repoName, commitMes return { success: true }; } catch (error) { - const errorMessage = error instanceof Error ? error.message : String(error); + const errorMessage = getErrorMessage(error); core.warning(`Failed to push extra empty commit: ${errorMessage}`); // Clean up the temporary remote on failure