@@ -64895,18 +64895,16 @@ let BASE_SHA;
6489564895 encoding: 'utf-8',
6489664896 });
6489764897 const HEAD_SHA = headResult.stdout;
64898- if ((['pull_request', 'pull_request_target'].includes(eventName) &&
64899- !github.context.payload.pull_request.merged) ||
64900- eventName == 'merge_group') {
64901- try {
64902- const mergeBaseRef = yield findMergeBaseRef();
64903- const baseResult = (0, child_process_1.spawnSync)('git', ['merge-base', `origin/${mainBranchName}`, mergeBaseRef], { encoding: 'utf-8' });
64904- BASE_SHA = baseResult.stdout;
64905- }
64906- catch (e) {
64907- core.setFailed(e.message);
64908- return;
64909- }
64898+ if (['pull_request', 'pull_request_target'].includes(eventName) &&
64899+ !github.context.payload.pull_request.merged) {
64900+ const baseResult = (0, child_process_1.spawnSync)('git', ['merge-base', `origin/${mainBranchName}`, 'HEAD'], { encoding: 'utf-8' });
64901+ BASE_SHA = baseResult.stdout;
64902+ }
64903+ else if (eventName == 'merge_group') {
64904+ const baseResult = (0, child_process_1.spawnSync)('git', ['rev-parse', 'HEAD^1'], {
64905+ encoding: 'utf-8',
64906+ });
64907+ BASE_SHA = baseResult.stdout;
6491064908 }
6491164909 else {
6491264910 try {
@@ -65016,35 +65014,6 @@ function findSuccessfulCommit(workflow_id, run_id, owner, repo, branch, lastSucc
6501665014 return yield findExistingCommit(octokit, branch, shas);
6501765015 });
6501865016}
65019- function findMergeBaseRef() {
65020- return __awaiter(this, void 0, void 0, function* () {
65021- if (eventName == 'merge_group') {
65022- const mergeQueueBranch = yield findMergeQueueBranch();
65023- return `origin/${mergeQueueBranch}`;
65024- }
65025- else {
65026- return 'HEAD';
65027- }
65028- });
65029- }
65030- function findMergeQueuePr() {
65031- const { head_ref, base_sha } = github.context.payload.merge_group;
65032- const result = new RegExp(`^refs/heads/gh-readonly-queue/${mainBranchName}/pr-(\\d+)-${base_sha}$`).exec(head_ref);
65033- return result ? result.at(1) : undefined;
65034- }
65035- function findMergeQueueBranch() {
65036- return __awaiter(this, void 0, void 0, function* () {
65037- const pull_number = findMergeQueuePr();
65038- if (!pull_number) {
65039- throw new Error('Failed to determine PR number');
65040- }
65041- process.stdout.write('\n');
65042- process.stdout.write(`Found PR #${pull_number} from merge queue branch\n`);
65043- const octokit = new ProxifiedClient();
65044- const result = yield octokit.request(`GET /repos/${owner}/${repo}/pulls/${pull_number}`, { owner, repo, pull_number: +pull_number });
65045- return result.data.head.ref;
65046- });
65047- }
6504865017/**
6504965018 * Get first existing commit
6505065019 */
0 commit comments