Add conditional footer control for PR review comments#15643
Conversation
- Add Footer field to CreatePullRequestReviewCommentsConfig - Support "always", "none", "if-body" values - Support boolean true/false mapping - Update pr_review_buffer to support conditional footer logic - Update handler managers to apply footer config - Add comprehensive tests for Go and JavaScript Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| includeFooter = value; | ||
| core.info(`PR review footer ${value ? "enabled" : "disabled"}`); | ||
| function setFooterMode(value) { | ||
| if (typeof value === "boolean") { |
There was a problem hiding this comment.
@copilot the JavaScript should only handle the three strings. Perform the conversion in the Go compiler.
There was a problem hiding this comment.
Done in commit 84c58a6. JavaScript now only handles string values ("always", "none", "if-body"). Boolean conversion is performed in the Go compiler before values reach JavaScript.
JavaScript now only handles string values ("always", "none", "if-body").
Boolean conversion (true->always, false->none) is performed in Go compiler
before values reach JavaScript, per review feedback.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a dedicated footer configuration for PR review comment workflows, enabling conditional footer inclusion (including a new "if-body" mode) while aiming to preserve backward compatibility.
Changes:
- Add
footer(string mode) tocreate-pull-request-review-commentsafe-outputs config with validation + bool→string mapping in Go. - Update the PR review buffer to support footer modes:
"always","none","if-body", and update handler managers to apply config with explicit priority. - Add/adjust Go + JS unit tests for the new footer behavior and config propagation.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/create_pr_review_comment.go | Parses and validates footer for PR review comments (string modes + bool mapping). |
| pkg/workflow/compiler_safe_outputs_config.go | Emits footer into handler manager config for create_pull_request_review_comment. |
| pkg/workflow/create_pr_review_comment_footer_test.go | Adds Go tests for parsing + handler-config emission of the new footer setting. |
| actions/setup/js/pr_review_buffer.cjs | Implements footer mode behavior (always/none/if-body) in review submission logic. |
| actions/setup/js/pr_review_buffer.test.cjs | Expands tests to cover new footer modes and reset behavior. |
| actions/setup/js/safe_output_handler_manager.cjs | Applies footer config to the shared PR review buffer with priority logic. |
| actions/setup/js/safe_output_unified_handler_manager.cjs | Same as above for unified manager path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * Set the footer mode for review body. | ||
| * Supported modes: | ||
| * - "always" (default): Always include footer | ||
| * - "none": Never include footer | ||
| * - "if-body": Only include footer if review body is non-empty | ||
| * Note: Boolean values are converted to strings in the Go compiler before reaching JavaScript. | ||
| * @param {string} value - Footer mode string | ||
| */ | ||
| function setIncludeFooter(value) { | ||
| includeFooter = value; | ||
| core.info(`PR review footer ${value ? "enabled" : "disabled"}`); | ||
| function setFooterMode(value) { | ||
| if (typeof value === "string") { | ||
| // Validate string mode | ||
| if (value === "always" || value === "none" || value === "if-body") { | ||
| footerMode = value; | ||
| core.info(`PR review footer mode set to "${footerMode}"`); | ||
| } else { | ||
| core.warning(`Invalid footer mode: "${value}". Using default "always". Valid values: "always", "none", "if-body"`); | ||
| footerMode = "always"; | ||
| } | ||
| } else { | ||
| core.warning(`Invalid footer mode type: ${typeof value}. Using default "always".`); | ||
| footerMode = "always"; | ||
| } | ||
| } |
There was a problem hiding this comment.
setIncludeFooter is labeled as a backward-compatibility alias, but it now points to setFooterMode and no longer supports the previous boolean contract. Any remaining callers passing false will hit the "invalid type" path and silently reset to the default "always" (re-enabling the footer). Consider keeping setIncludeFooter(value: boolean) semantics by mapping booleans to modes (false→"none", true→"always"), while keeping setFooterMode(value: string) as the new string-only API.
| } | ||
|
|
||
| if (footerConfig !== undefined) { | ||
| prReviewBuffer.setFooterMode(footerConfig); |
There was a problem hiding this comment.
submit_pull_request_review.footer is still emitted as a boolean by the Go compiler (via AddBoolPtr/getEffectiveFooter), but here it’s forwarded into prReviewBuffer.setFooterMode(), which only accepts strings. As a result, footer: false (or global safe-outputs.footer: false) will be treated as an invalid type and the buffer will fall back to the default "always", re-enabling the footer unexpectedly. Normalize boolean values to the corresponding string modes (false→"none", true→"always") before calling setFooterMode, or change the Go handler config to emit a string mode for submit_pull_request_review.footer as well.
| prReviewBuffer.setFooterMode(footerConfig); | |
| let normalizedFooterConfig = footerConfig; | |
| if (typeof footerConfig === "boolean") { | |
| normalizedFooterConfig = footerConfig ? "always" : "none"; | |
| } | |
| prReviewBuffer.setFooterMode(normalizedFooterConfig); |
| core.info(`Using footer config from submit_pull_request_review: ${footerConfig}`); | ||
| } | ||
|
|
||
| if (footerConfig !== undefined) { |
There was a problem hiding this comment.
Same issue as in safe_output_handler_manager.cjs: configs.regular.submit_pull_request_review.footer comes from Go as a boolean, but it’s passed into setFooterMode() which only accepts strings. This causes footer: false (and global footer disable) to be ignored and the footer mode to revert to the default "always". Convert boolean to string mode (false→"none", true→"always") before calling setFooterMode, or update the Go config emission for submit_pull_request_review to provide a string footer mode.
| if (footerConfig !== undefined) { | |
| if (footerConfig !== undefined) { | |
| // Normalize boolean footer configs (from Go) to string modes expected by setFooterMode | |
| if (typeof footerConfig === "boolean") { | |
| footerConfig = footerConfig ? "always" : "none"; | |
| core.info(`Normalized boolean footer config to mode: ${footerConfig}`); | |
| } |
Document the new footer field for create-pull-request-review-comment that was added in PR #15643. This feature enables conditional footer display on PR review comments with three modes: always, none, and if-body. Changes: - Add footer field documentation to safe-outputs.md PR review comments section - Add dedicated PR review comment footer control section to footers.md - Include examples and use cases for the if-body mode The if-body mode is particularly useful for clean approval reviews without body text, reducing footer noise while maintaining attribution for reviews with explanatory text. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…mpatibility The Copilot PR reviewer on github#15643 identified that submit_pull_request_review.footer is still emitted as a boolean by the Go compiler (via AddBoolPtr/getEffectiveFooter), but setFooterMode() in JavaScript only accepts strings after the PR review footer refactoring. This caused footer: false to be silently ignored, defaulting back to 'always' (the opposite of the user's intent). Fix: Add boolean normalization in setFooterMode() so that: - false maps to 'none' (disable footer) - true maps to 'always' (enable footer) This also fixes the setIncludeFooter() backward-compatibility alias, which previously would reject boolean values passed through the old API contract. Added 3 new test cases covering: - setFooterMode(false) -> 'none' - setFooterMode(true) -> 'always' - setIncludeFooter(false) backward compatibility Co-authored-by: Bill Easton <williamseaston@gmail.com>
Implementation Complete: PR Review Footer Configuration
Summary
Successfully implemented dedicated
footersetting for PR Review comments that supports conditional footer display.Features Implemented
footerfield oncreate-pull-request-review-commentconfiguration"always"(default),"none","if-body"true→"always",false→"none"(in Go)Implementation Details
Go Changes:
Footer *stringfield toCreatePullRequestReviewCommentsConfigJavaScript Changes:
pr_review_buffer.cjswith conditional footer logicsetIncludeFooter()alias for string valuesTests:
Recent Changes (per review feedback)
Usage Example
Result: Clean approval reviews without footer noise when body is empty.
Files Changed
pkg/workflow/create_pr_review_comment.gopkg/workflow/create_pr_review_comment_footer_test.gopkg/workflow/compiler_safe_outputs_config.goactions/setup/js/pr_review_buffer.cjsactions/setup/js/pr_review_buffer.test.cjsactions/setup/js/safe_output_handler_manager.cjsactions/setup/js/safe_output_unified_handler_manager.cjsValidation
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.