feat: add configurable context_window action input

This commit is contained in:
2026-06-01 11:25:02 -05:00
parent efbf42f3e0
commit eb8871d6d2
3 changed files with 18 additions and 4 deletions
+10
View File
@@ -11,6 +11,7 @@ const PushPermissionInput = type.enumerated("disabled", "restricted", "enabled")
export const Inputs = type({
prompt: "string",
"model?": type.string.or("undefined"),
"context_window?": type.number.or("undefined"),
"timeout?": type.string.or("undefined"),
"push?": PushPermissionInput.or("undefined"),
"shell?": ShellPermissionInput.or("undefined"),
@@ -58,8 +59,10 @@ export function resolvePromptInput(): ResolvedPromptInput {
}
function resolveNonPromptInputs() {
const contextWindowRaw = core.getInput("context_window");
return Inputs.omit("prompt").assert({
model: core.getInput("model") || undefined,
context_window: contextWindowRaw ? parseInt(contextWindowRaw, 10) : undefined,
timeout: core.getInput("timeout") || undefined,
cwd: core.getInput("cwd") || undefined,
push: (core.getInput("push") as "disabled" | "restricted" | "enabled") || undefined,
@@ -93,6 +96,12 @@ export function resolvePayload(
const model =
str(jsonPayload, "model") ?? inputs.model ?? repoSettings.model ?? process.env.OLLAMA_MODEL ?? undefined;
const contextWindowStr = str(jsonPayload, "context_window");
const contextWindow =
(contextWindowStr ? parseInt(contextWindowStr, 10) : undefined) ??
inputs.context_window ??
undefined;
const isNonCollaborator = !isCollaborator(event);
const repoShell = repoSettings.shell ?? "restricted";
const inputShell = inputs.shell;
@@ -110,6 +119,7 @@ export function resolvePayload(
return {
"~shockbot": true as const,
model,
contextWindow,
prompt,
triggerer:
str(jsonPayload, "triggerer") ?? process.env.GITHUB_ACTOR ?? undefined,