From eaf7b67abd8a44e32b60803e2f22272f2ec72f11 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 13 Mar 2026 18:58:30 +0000 Subject: [PATCH] refactor: simplify targetRepoName extraction using split().at(-1) Replace the verbose conditional with substring/indexOf with the more idiomatic split("/").at(-1) which handles both the "owner/repo" and "repo-only" cases naturally. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- actions/setup/js/resolve_host_repo.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/setup/js/resolve_host_repo.cjs b/actions/setup/js/resolve_host_repo.cjs index e505fa345d..d460f6ad8e 100644 --- a/actions/setup/js/resolve_host_repo.cjs +++ b/actions/setup/js/resolve_host_repo.cjs @@ -72,7 +72,7 @@ async function main() { // Compute the repository name (without owner prefix) for use cases that require // only the repo name, such as actions/create-github-app-token which expects // `repositories` to contain repo names only when `owner` is also provided. - const targetRepoName = targetRepo.includes("/") ? targetRepo.substring(targetRepo.indexOf("/") + 1) : targetRepo; + const targetRepoName = targetRepo.split("/").at(-1); core.setOutput("target_repo", targetRepo); core.setOutput("target_repo_name", targetRepoName);