From db3990c61a1f27e41c8ead66d942fffb3d0a678d Mon Sep 17 00:00:00 2001 From: Miroslav Jonas Date: Thu, 6 Mar 2025 14:51:53 +0100 Subject: [PATCH] fix: switch base to point to base.ref over main branching point --- dist/index.js | 6 +++++- find-successful-workflow.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 4296b2f..03434eb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -29960,7 +29960,11 @@ let BASE_SHA; let HEAD_SHA = headResult.stdout; if (['pull_request', 'pull_request_target'].includes(eventName) && !github.context.payload.pull_request.merged) { - const baseResult = (0, child_process_1.spawnSync)('git', ['merge-base', `origin/${mainBranchName}`, 'HEAD'], { encoding: 'utf-8' }); + const baseResult = (0, child_process_1.spawnSync)('git', [ + 'merge-base', + `origin/${github.context.payload[eventName].base.ref}`, + 'HEAD', + ], { encoding: 'utf-8' }); BASE_SHA = baseResult.stdout; } else if (eventName == 'merge_group') { diff --git a/find-successful-workflow.ts b/find-successful-workflow.ts index 5768a48..1be537b 100644 --- a/find-successful-workflow.ts +++ b/find-successful-workflow.ts @@ -44,7 +44,11 @@ let BASE_SHA: string; ) { const baseResult = spawnSync( 'git', - ['merge-base', `origin/${mainBranchName}`, 'HEAD'], + [ + 'merge-base', + `origin/${github.context.payload[eventName].base.ref}`, + 'HEAD', + ], { encoding: 'utf-8' }, ); BASE_SHA = baseResult.stdout;