Skip to content

Commit 419980f

Browse files
committed
build
1 parent 69f108d commit 419980f

File tree

2 files changed

+23
-45
lines changed

2 files changed

+23
-45
lines changed

dist/index.js

Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -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
*/

find-successful-workflow.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,20 @@ let BASE_SHA: string;
4040
});
4141
const HEAD_SHA = headResult.stdout;
4242

43-
if (['pull_request', 'pull_request_target'].includes(eventName) && !github.context.payload.pull_request.merged) {
44-
const baseResult = spawnSync('git', ['merge-base', `origin/${mainBranchName}`, 'HEAD'], { encoding: 'utf-8' });
43+
if (
44+
['pull_request', 'pull_request_target'].includes(eventName) &&
45+
!github.context.payload.pull_request.merged
46+
) {
47+
const baseResult = spawnSync(
48+
'git',
49+
['merge-base', `origin/${mainBranchName}`, 'HEAD'],
50+
{ encoding: 'utf-8' },
51+
);
4552
BASE_SHA = baseResult.stdout;
46-
} else if (eventName == "merge_group") {
47-
const baseResult = spawnSync('git', ['rev-parse', 'HEAD^1'], { encoding: 'utf-8' });
53+
} else if (eventName == 'merge_group') {
54+
const baseResult = spawnSync('git', ['rev-parse', 'HEAD^1'], {
55+
encoding: 'utf-8',
56+
});
4857
BASE_SHA = baseResult.stdout;
4958
} else {
5059
try {

0 commit comments

Comments
 (0)