0.0.138
This commit is contained in:
@@ -97449,7 +97449,7 @@ function query({
|
||||
// package.json
|
||||
var package_default = {
|
||||
name: "@pullfrog/action",
|
||||
version: "0.0.137",
|
||||
version: "0.0.138",
|
||||
type: "module",
|
||||
files: [
|
||||
"index.js",
|
||||
@@ -124725,15 +124725,13 @@ var PullRequestTool = tool({
|
||||
|
||||
// mcp/prInfo.ts
|
||||
init_out4();
|
||||
init_cli();
|
||||
init_github();
|
||||
init_shared3();
|
||||
var PullRequestInfo = type({
|
||||
pull_number: type.number.describe("The pull request number to fetch")
|
||||
});
|
||||
var PullRequestInfoTool = tool({
|
||||
name: "get_pull_request",
|
||||
description: "Retrieve PR information. Automatically fetches and checks out the PR branch.",
|
||||
description: "Retrieve PR information (metadata only). PR branch is already checked out during setup.",
|
||||
parameters: PullRequestInfo,
|
||||
execute: contextualize(async ({ pull_number }, ctx) => {
|
||||
const pr = await ctx.octokit.rest.pulls.get({
|
||||
@@ -124742,29 +124740,7 @@ var PullRequestInfoTool = tool({
|
||||
pull_number
|
||||
});
|
||||
const data = pr.data;
|
||||
const baseBranch = data.base.ref;
|
||||
const headBranch = data.head.ref;
|
||||
if (!baseBranch) {
|
||||
throw new Error(`Base branch not found for PR #${pull_number}`);
|
||||
}
|
||||
const baseRepo = data.base.repo.full_name;
|
||||
const headRepo = data.head.repo.full_name;
|
||||
const isFork = headRepo !== baseRepo;
|
||||
log.info(`Checking out PR #${pull_number} using gh pr checkout`);
|
||||
const token = getGitHubInstallationToken();
|
||||
$("gh", ["pr", "checkout", pull_number.toString()], {
|
||||
env: { GH_TOKEN: token }
|
||||
});
|
||||
log.info(`Fetching base branch: origin/${baseBranch}`);
|
||||
$("git", ["fetch", "origin", baseBranch, "--depth=20"]);
|
||||
const currentBranch = $("git", ["rev-parse", "--abbrev-ref", "HEAD"], { log: false }).trim();
|
||||
const currentSha = $("git", ["rev-parse", "HEAD"], { log: false }).trim();
|
||||
const baseSha = $("git", ["rev-parse", `origin/${baseBranch}`], { log: false }).trim();
|
||||
const summary2 = `PR branch has been fetched and checked out:
|
||||
- Base branch: \`origin/${baseBranch}\` (${baseSha.substring(0, 7)})
|
||||
- PR branch: \`${headBranch}\` (checked out locally, ${currentSha.substring(0, 7)})
|
||||
- Current branch: \`${currentBranch}\`
|
||||
- View diff: \`git diff origin/${baseBranch}...HEAD\``;
|
||||
const isFork = data.head.repo.full_name !== data.base.repo.full_name;
|
||||
return {
|
||||
number: data.number,
|
||||
url: data.html_url,
|
||||
@@ -124772,10 +124748,9 @@ var PullRequestInfoTool = tool({
|
||||
state: data.state,
|
||||
draft: data.draft,
|
||||
merged: data.merged,
|
||||
base: baseBranch,
|
||||
head: headBranch,
|
||||
isFork,
|
||||
summary: summary2
|
||||
base: data.base.ref,
|
||||
head: data.head.ref,
|
||||
isFork
|
||||
};
|
||||
})
|
||||
});
|
||||
@@ -125151,47 +125126,19 @@ function setupGitAuth(ctx) {
|
||||
log.info("\u2713 Updated remote URL with authentication token (scoped to repo)");
|
||||
}
|
||||
function setupGitBranch(payload) {
|
||||
const branch = payload.event.branch;
|
||||
const repoDir = process.cwd();
|
||||
if (!branch) {
|
||||
log.debug("No branch specified in payload, using default branch");
|
||||
if (payload.event.is_pr !== true || !payload.event.issue_number) {
|
||||
log.debug("Not a PR event, staying on default branch");
|
||||
return;
|
||||
}
|
||||
log.info(`\u{1F33F} Setting up git branch: ${branch}`);
|
||||
if (payload.event.is_pr === true && payload.event.issue_number) {
|
||||
const prNumber = payload.event.issue_number;
|
||||
try {
|
||||
log.debug(`Checking out PR #${prNumber} using gh pr checkout`);
|
||||
const token = getGitHubInstallationToken();
|
||||
$("gh", ["pr", "checkout", prNumber.toString()], {
|
||||
cwd: repoDir,
|
||||
env: { GH_TOKEN: token }
|
||||
});
|
||||
log.info(`\u2713 Successfully checked out PR branch: ${branch}`);
|
||||
return;
|
||||
} catch (error41) {
|
||||
log.debug(
|
||||
`gh pr checkout 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}`, {
|
||||
cwd: repoDir,
|
||||
stdio: "pipe"
|
||||
});
|
||||
log.debug(`Checking out branch: ${branch}`);
|
||||
execSync(`git checkout -B ${branch} origin/${branch}`, {
|
||||
cwd: repoDir,
|
||||
stdio: "pipe"
|
||||
});
|
||||
log.info(`\u2713 Successfully checked out branch: ${branch}`);
|
||||
} catch (error41) {
|
||||
log.warning(
|
||||
`Failed to checkout branch ${branch}: ${error41 instanceof Error ? error41.message : String(error41)}`
|
||||
);
|
||||
}
|
||||
const prNumber = payload.event.issue_number;
|
||||
const repoDir = process.cwd();
|
||||
log.info(`\u{1F33F} Checking out PR #${prNumber}...`);
|
||||
const token = getGitHubInstallationToken();
|
||||
$("gh", ["pr", "checkout", prNumber.toString()], {
|
||||
cwd: repoDir,
|
||||
env: { GH_TOKEN: token }
|
||||
});
|
||||
log.info(`\u2713 Successfully checked out PR #${prNumber}`);
|
||||
}
|
||||
|
||||
// utils/timer.ts
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pullfrog/action",
|
||||
"version": "0.0.137",
|
||||
"version": "0.0.138",
|
||||
"type": "module",
|
||||
"files": [
|
||||
"index.js",
|
||||
|
||||
Reference in New Issue
Block a user