From d18eee4474c2fc36a08389b763050a638bfa1834 Mon Sep 17 00:00:00 2001 From: Timor Raiman Date: Tue, 18 Apr 2023 17:25:12 +0300 Subject: [PATCH] Working with pullrequests, must stick to target repo consistently Signed-off-by: Timor Raiman --- dist/index.js | 7 +++++-- src/action-ros-ci.ts | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 355c1499..48820f07 100644 --- a/dist/index.js +++ b/dist/index.js @@ -11546,10 +11546,13 @@ done`; // being built. let repoFullName = process.env.GITHUB_REPOSITORY; if (github.context.payload.pull_request) { - repoFullName = github.context.payload.pull_request.head.repo.full_name; + repoFullName = github.context.payload.pull_request.base.repo.full_name; } const headRef = process.env.GITHUB_HEAD_REF; - const commitRef = headRef || github.context.sha; + let commitRef = headRef || github.context.sha; + if (github.context.payload.pull_request) { + commitRef = github.context.sha; + } const repoFilePath = path.join(rosWorkspaceDir, "package.repo"); // Add a random string prefix to avoid naming collisions when checking out the test repository const randomStringPrefix = Math.random().toString(36).substring(2, 15); diff --git a/src/action-ros-ci.ts b/src/action-ros-ci.ts index f432e59d..28b99adc 100644 --- a/src/action-ros-ci.ts +++ b/src/action-ros-ci.ts @@ -555,10 +555,13 @@ done`; // being built. let repoFullName = process.env.GITHUB_REPOSITORY as string; if (github.context.payload.pull_request) { - repoFullName = github.context.payload.pull_request.head.repo.full_name; + repoFullName = github.context.payload.pull_request.base.repo.full_name; } const headRef = process.env.GITHUB_HEAD_REF as string; - const commitRef = headRef || github.context.sha; + let commitRef = headRef || github.context.sha; + if (github.context.payload.pull_request) { + commitRef = github.context.sha; + } const repoFilePath = path.join(rosWorkspaceDir, "package.repo"); // Add a random string prefix to avoid naming collisions when checking out the test repository const randomStringPrefix = Math.random().toString(36).substring(2, 15);