Request reviews from the PR's human initiator (#340)

* Request reviews from the PR's human initiator

* add logs

* await the request reviewers call
This commit is contained in:
Mateusz Burzyński
2026-02-19 14:00:57 +00:00
committed by pullfrog[bot]
parent df3ec6b815
commit 4ecff49b72
5 changed files with 48 additions and 0 deletions
+20
View File
@@ -143434,6 +143434,20 @@ function CreatePullRequestTool(ctx) {
head: currentBranch,
base
});
const reviewer = ctx.payload.triggeringUser;
if (reviewer) {
try {
log.debug(`Requesting review from ${reviewer} on PR #${result.data.number}`);
await ctx.octokit.rest.pulls.requestReviewers({
owner: ctx.repo.owner,
repo: ctx.repo.name,
pull_number: result.data.number,
reviewers: [reviewer]
});
} catch {
log.info(`failed to request review from ${reviewer} on PR #${result.data.number}`);
}
}
return {
success: true,
pullRequestId: result.data.id,
@@ -146638,6 +146652,7 @@ var JsonPayload = type({
version: "string",
"agent?": AgentName.or("undefined"),
prompt: "string",
"triggeringUser?": "string | undefined",
"eventInstructions?": "string",
"repoInstructions?": "string",
"event?": "object",
@@ -146701,6 +146716,9 @@ function resolveNonPromptInputs() {
bash: core4.getInput("bash") || void 0
});
}
var isPullfrog = (actor) => {
return !!actor && (actor === "pullfrog" || actor === "pullfrog[bot]");
};
function resolvePayload(resolvedPromptInput, repoSettings) {
const [prompt, jsonPayload] = typeof resolvedPromptInput !== "string" ? [resolvedPromptInput.prompt, resolvedPromptInput] : [resolvedPromptInput, void 0];
const inputs = resolveNonPromptInputs();
@@ -146726,6 +146744,8 @@ function resolvePayload(resolvedPromptInput, repoSettings) {
version: jsonPayload?.version ?? package_default.version,
agent: resolvedAgent,
prompt,
triggeringUser: jsonPayload?.triggeringUser ?? // it's not a common use case but GITHUB_ACTOR can be a user when the workflow is manually triggered by a user through GitHub Actions UI
(!isPullfrog(process.env.GITHUB_ACTOR) ? process.env.GITHUB_ACTOR : void 0),
eventInstructions: jsonPayload?.eventInstructions,
repoInstructions: jsonPayload?.repoInstructions,
event,