This commit is contained in:
Colin McDonnell
2025-12-15 19:10:24 -08:00
parent b7511752b6
commit dc93c89c24
2 changed files with 28 additions and 6 deletions
+27 -5
View File
@@ -97443,7 +97443,7 @@ function query({
// package.json
var package_default = {
name: "@pullfrog/action",
version: "0.0.135",
version: "0.0.136",
type: "module",
files: [
"index.js",
@@ -124808,10 +124808,10 @@ var PullRequestInfoTool = tool({
}
log.info(`Fetching base branch: origin/${baseBranch}`);
$("git", ["fetch", "origin", baseBranch, "--depth=20"]);
log.info(`Fetching PR branch: origin/${headBranch}`);
$("git", ["fetch", "origin", headBranch]);
log.info(`Checking out PR branch: origin/${headBranch}`);
$("git", ["checkout", "-B", headBranch, `origin/${headBranch}`]);
log.info(`Fetching PR #${pull_number} using refs/pull/${pull_number}/head`);
$("git", ["fetch", "origin", `refs/pull/${pull_number}/head`]);
log.info(`Checking out PR branch: ${headBranch}`);
$("git", ["checkout", "-B", headBranch, "FETCH_HEAD"]);
return {
number: data.number,
url: data.html_url,
@@ -125202,6 +125202,28 @@ function setupGitBranch(payload) {
return;
}
log.info(`\u{1F33F} Setting up git branch: ${branch}`);
const issueNumber = "issue_number" in payload.event ? payload.event.issue_number : void 0;
const isLikelyPR = issueNumber !== void 0 && branch !== void 0;
if (isLikelyPR) {
try {
log.debug(`Fetching PR #${issueNumber} using refs/pull/${issueNumber}/head`);
execSync(`git fetch origin refs/pull/${issueNumber}/head`, {
cwd: repoDir,
stdio: "pipe"
});
log.debug(`Checking out branch: ${branch}`);
execSync(`git checkout -B ${branch} FETCH_HEAD`, {
cwd: repoDir,
stdio: "pipe"
});
log.info(`\u2713 Successfully checked out PR branch: ${branch}`);
return;
} catch (error41) {
log.debug(
`PR ref fetch failed, falling back to branch name fetch: ${error41 instanceof Error ? error41.message : String(error41)}`
);
}
}
try {
log.debug(`Fetching branch from origin: ${branch}`);
execSync(`git fetch origin ${branch}`, {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@pullfrog/action",
"version": "0.0.135",
"version": "0.0.136",
"type": "module",
"files": [
"index.js",