Skip to content

Commit bf7aed4

Browse files
authored
Add customization field for footer and notification message formats (#4864)
1 parent 076ee30 commit bf7aed4

File tree

8 files changed

+1276
-0
lines changed

8 files changed

+1276
-0
lines changed

docs/src/content/docs/reference/frontmatter-full.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2176,6 +2176,34 @@ safe-outputs:
21762176
jobs:
21772177
{}
21782178

2179+
# Custom message templates for safe-output footer and notification messages. Use
2180+
# format strings with placeholders like {workflow_name}, {run_url},
2181+
# {triggering_number}.
2182+
# (optional)
2183+
messages:
2184+
# Custom footer message template for AI-generated content. Available placeholders:
2185+
# {workflow_name}, {run_url}, {triggering_number}, {workflow_source},
2186+
# {workflow_source_url}. Example: '> Generated by [{workflow_name}]({run_url})'
2187+
# (optional)
2188+
footer: "example-value"
2189+
2190+
# Custom installation instructions template appended to the footer. Available
2191+
# placeholders: {workflow_source}, {workflow_source_url}. Example: '> Install: `gh
2192+
# aw add {workflow_source}`'
2193+
# (optional)
2194+
footer-install: "example-value"
2195+
2196+
# Custom title template for staged mode preview. Available placeholders:
2197+
# {operation}. Example: '🎭 Preview: {operation}'
2198+
# (optional)
2199+
staged-title: "example-value"
2200+
2201+
# Custom description template for staged mode preview. Available placeholders:
2202+
# {operation}. Example: 'The following {operation} would occur if staged mode was
2203+
# disabled:'
2204+
# (optional)
2205+
staged-description: "example-value"
2206+
21792207
# Runner specification for all safe-outputs jobs (activation, create-issue,
21802208
# add-comment, etc.). Single runner label (e.g., 'ubuntu-slim', 'ubuntu-latest',
21812209
# 'windows-latest', 'self-hosted'). Defaults to 'ubuntu-slim'. See

pkg/parser/schemas/main_workflow_schema.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3618,6 +3618,57 @@
36183618
},
36193619
"additionalProperties": false
36203620
},
3621+
"messages": {
3622+
"type": "object",
3623+
"description": "Custom message templates for safe-output footer and notification messages. Available placeholders: {workflow_name} (workflow name), {run_url} (GitHub Actions run URL), {triggering_number} (issue/PR/discussion number), {workflow_source} (owner/repo/path@ref), {workflow_source_url} (GitHub URL to source), {operation} (safe-output operation name for staged mode).",
3624+
"properties": {
3625+
"footer": {
3626+
"type": "string",
3627+
"description": "Custom footer message template for AI-generated content. Available placeholders: {workflow_name}, {run_url}, {triggering_number}, {workflow_source}, {workflow_source_url}. Example: '> Generated by [{workflow_name}]({run_url})'",
3628+
"examples": [
3629+
"> Generated by [{workflow_name}]({run_url})",
3630+
"> AI output from [{workflow_name}]({run_url}) for #{triggering_number}"
3631+
]
3632+
},
3633+
"footer-install": {
3634+
"type": "string",
3635+
"description": "Custom installation instructions template appended to the footer. Available placeholders: {workflow_source}, {workflow_source_url}. Example: '> Install: `gh aw add {workflow_source}`'",
3636+
"examples": ["> Install: `gh aw add {workflow_source}`", "> [Add this workflow]({workflow_source_url})"]
3637+
},
3638+
"staged-title": {
3639+
"type": "string",
3640+
"description": "Custom title template for staged mode preview. Available placeholders: {operation}. Example: '🎭 Preview: {operation}'",
3641+
"examples": ["🎭 Preview: {operation}", "## Staged Mode: {operation}"]
3642+
},
3643+
"staged-description": {
3644+
"type": "string",
3645+
"description": "Custom description template for staged mode preview. Available placeholders: {operation}. Example: 'The following {operation} would occur if staged mode was disabled:'",
3646+
"examples": ["The following {operation} would occur if staged mode was disabled:"]
3647+
},
3648+
"run-started": {
3649+
"type": "string",
3650+
"description": "Custom message template for workflow activation comment. Available placeholders: {workflow_name}, {run_url}, {event_type}. Default: 'Agentic [{workflow_name}]({run_url}) triggered by this {event_type}.'",
3651+
"examples": [
3652+
"Agentic [{workflow_name}]({run_url}) triggered by this {event_type}.",
3653+
"[{workflow_name}]({run_url}) started processing this {event_type}."
3654+
]
3655+
},
3656+
"run-success": {
3657+
"type": "string",
3658+
"description": "Custom message template for successful workflow completion. Available placeholders: {workflow_name}, {run_url}. Default: '✅ Agentic [{workflow_name}]({run_url}) completed successfully.'",
3659+
"examples": ["✅ Agentic [{workflow_name}]({run_url}) completed successfully.", "✅ [{workflow_name}]({run_url}) finished."]
3660+
},
3661+
"run-failure": {
3662+
"type": "string",
3663+
"description": "Custom message template for failed workflow. Available placeholders: {workflow_name}, {run_url}, {status}. Default: '❌ Agentic [{workflow_name}]({run_url}) {status} and wasn't able to produce a result.'",
3664+
"examples": [
3665+
"❌ Agentic [{workflow_name}]({run_url}) {status} and wasn't able to produce a result.",
3666+
"❌ [{workflow_name}]({run_url}) {status}."
3667+
]
3668+
}
3669+
},
3670+
"additionalProperties": false
3671+
},
36213672
"runs-on": {
36223673
"type": "string",
36233674
"description": "Runner specification for all safe-outputs jobs (activation, create-issue, add-comment, etc.). Single runner label (e.g., 'ubuntu-slim', 'ubuntu-latest', 'windows-latest', 'self-hosted'). Defaults to 'ubuntu-slim'. See https://github.blog/changelog/2025-10-28-1-vcpu-linux-runner-now-available-in-github-actions-in-public-preview/"

pkg/workflow/compiler.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,18 @@ type SafeOutputsConfig struct {
288288
GitHubToken string `yaml:"github-token,omitempty"` // GitHub token for safe output jobs
289289
MaximumPatchSize int `yaml:"max-patch-size,omitempty"` // Maximum allowed patch size in KB (defaults to 1024)
290290
RunsOn string `yaml:"runs-on,omitempty"` // Runner configuration for safe-outputs jobs
291+
Messages *SafeOutputMessagesConfig `yaml:"messages,omitempty"` // Custom message templates for footer and notifications
292+
}
293+
294+
// SafeOutputMessagesConfig holds custom message templates for safe-output footer and notification messages
295+
type SafeOutputMessagesConfig struct {
296+
Footer string `yaml:"footer,omitempty"` // Custom footer message template
297+
FooterInstall string `yaml:"footer-install,omitempty"` // Custom installation instructions template
298+
StagedTitle string `yaml:"staged-title,omitempty"` // Custom staged mode title template
299+
StagedDescription string `yaml:"staged-description,omitempty"` // Custom staged mode description template
300+
RunStarted string `yaml:"run-started,omitempty"` // Custom workflow activation message template
301+
RunSuccess string `yaml:"run-success,omitempty"` // Custom workflow success message template
302+
RunFailure string `yaml:"run-failure,omitempty"` // Custom workflow failure message template
291303
}
292304

293305
// SecretMaskingConfig holds configuration for secret redaction behavior

pkg/workflow/js.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ var generateFooterScript string
129129
//go:embed js/get_tracker_id.cjs
130130
var getTrackerIDScript string
131131

132+
//go:embed js/messages.cjs
133+
var messagesScript string
134+
132135
//go:embed js/get_repository_url.cjs
133136
var getRepositoryUrlScript string
134137

@@ -178,6 +181,7 @@ func GetJavaScriptSources() map[string]string {
178181
"update_activation_comment.cjs": updateActivationCommentScript,
179182
"generate_footer.cjs": generateFooterScript,
180183
"get_tracker_id.cjs": getTrackerIDScript,
184+
"messages.cjs": messagesScript,
181185
"get_repository_url.cjs": getRepositoryUrlScript,
182186
"check_permissions_utils.cjs": checkPermissionsUtilsScript,
183187
"normalize_branch_name.cjs": normalizeBranchNameScript,

0 commit comments

Comments
 (0)