Add prefix and suffix inputs to wrap comment body

Co-authored-by: marocchino <128431+marocchino@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-03-13 12:52:46 +00:00
parent 58d8e91c23
commit 5b837e833d
4 changed files with 87 additions and 2 deletions

View file

@ -50,13 +50,17 @@ export async function getBody(): Promise<string> {
const followSymbolicLinks = core.getBooleanInput("follow_symbolic_links", {
required: true,
})
const prefixInput = core.getInput("prefix", {required: false})
const suffixInput = core.getInput("suffix", {required: false})
let body: string
if (pathInput && pathInput.length > 0) {
try {
const globber = await create(pathInput.join("\n"), {
followSymbolicLinks,
matchDirectories: false,
})
return (await globber.glob()).map(path => readFileSync(path, "utf-8")).join("\n")
body = (await globber.glob()).map(path => readFileSync(path, "utf-8")).join("\n")
} catch (error) {
if (error instanceof Error) {
core.setFailed(error.message)
@ -64,6 +68,16 @@ export async function getBody(): Promise<string> {
return ""
}
} else {
return core.getInput("message", {required: false})
body = core.getInput("message", {required: false})
}
if (prefixInput || suffixInput) {
const parts: string[] = []
if (prefixInput) parts.push(prefixInput)
parts.push(body)
if (suffixInput) parts.push(suffixInput)
return parts.join("\n")
}
return body
}