From be5508988b1e606c06b7637e361f2391c566d894 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Mar 2026 20:18:50 +0000 Subject: [PATCH 1/2] Initial plan From 64ee9a5c3743acb601ae1be2544a2949a88845fe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Mar 2026 20:28:18 +0000 Subject: [PATCH 2/2] fix: upgrade tsconfig target/lib to es2022 to fix TS2550 error with Array.at() Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> --- actions/setup/js/resolve_host_repo.cjs | 6 +++++ actions/setup/js/resolve_host_repo.test.cjs | 27 +++++++++++++++++++++ actions/setup/js/tsconfig.json | 4 +-- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/actions/setup/js/resolve_host_repo.cjs b/actions/setup/js/resolve_host_repo.cjs index e6c94a0cf0f..d460f6ad8ec 100644 --- a/actions/setup/js/resolve_host_repo.cjs +++ b/actions/setup/js/resolve_host_repo.cjs @@ -69,7 +69,13 @@ async function main() { core.info(`Same-repo invocation: checking out ${targetRepo} @ ${targetRef}`); } + // 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.split("/").at(-1); + core.setOutput("target_repo", targetRepo); + core.setOutput("target_repo_name", targetRepoName); core.setOutput("target_ref", targetRef); } diff --git a/actions/setup/js/resolve_host_repo.test.cjs b/actions/setup/js/resolve_host_repo.test.cjs index 5b203caf056..a4a0afb1b98 100644 --- a/actions/setup/js/resolve_host_repo.test.cjs +++ b/actions/setup/js/resolve_host_repo.test.cjs @@ -199,6 +199,33 @@ describe("resolve_host_repo.cjs", () => { expect(mockCore.setOutput).toHaveBeenCalledWith("target_ref", "abc123def456"); }); + it("should output target_repo_name when invoked cross-repo", async () => { + process.env.GITHUB_WORKFLOW_REF = "my-org/platform-repo/.github/workflows/gateway.lock.yml@refs/heads/main"; + process.env.GITHUB_REPOSITORY = "my-org/app-repo"; + + await main(); + + expect(mockCore.setOutput).toHaveBeenCalledWith("target_repo_name", "platform-repo"); + }); + + it("should output target_repo_name when same-repo invocation", async () => { + process.env.GITHUB_WORKFLOW_REF = "my-org/platform-repo/.github/workflows/gateway.lock.yml@refs/heads/main"; + process.env.GITHUB_REPOSITORY = "my-org/platform-repo"; + + await main(); + + expect(mockCore.setOutput).toHaveBeenCalledWith("target_repo_name", "platform-repo"); + }); + + it("should output target_repo_name without owner prefix when falling back to GITHUB_REPOSITORY", async () => { + process.env.GITHUB_WORKFLOW_REF = ""; + process.env.GITHUB_REPOSITORY = "my-org/fallback-repo"; + + await main(); + + expect(mockCore.setOutput).toHaveBeenCalledWith("target_repo_name", "fallback-repo"); + }); + it("should include target_ref in step summary for cross-repo invocations", async () => { process.env.GITHUB_WORKFLOW_REF = "my-org/platform-repo/.github/workflows/gateway.lock.yml@refs/heads/feature-branch"; process.env.GITHUB_REPOSITORY = "my-org/app-repo"; diff --git a/actions/setup/js/tsconfig.json b/actions/setup/js/tsconfig.json index acc316a4165..6acdfe964f1 100644 --- a/actions/setup/js/tsconfig.json +++ b/actions/setup/js/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { - "target": "es2020", + "target": "es2022", "module": "commonjs", - "lib": ["es2020"], + "lib": ["es2022"], "types": ["node"], "allowJs": true, "checkJs": true,