-
Notifications
You must be signed in to change notification settings - Fork 298
Add conditional footer control for PR review comments #15643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -737,9 +737,21 @@ async function main() { | |||||||||||||
| // Create the shared PR review buffer instance (no global state) | ||||||||||||||
| const prReviewBuffer = createReviewBuffer(); | ||||||||||||||
|
|
||||||||||||||
| // Apply footer config from submit_pull_request_review (if configured) | ||||||||||||||
| if (config.submit_pull_request_review?.footer === false) { | ||||||||||||||
| prReviewBuffer.setIncludeFooter(false); | ||||||||||||||
| // Apply footer config with priority: | ||||||||||||||
| // 1. create_pull_request_review_comment.footer (highest priority) | ||||||||||||||
| // 2. submit_pull_request_review.footer (fallback) | ||||||||||||||
| // 3. Default: "always" | ||||||||||||||
| let footerConfig = undefined; | ||||||||||||||
| if (config.create_pull_request_review_comment?.footer !== undefined) { | ||||||||||||||
| footerConfig = config.create_pull_request_review_comment.footer; | ||||||||||||||
| core.info(`Using footer config from create_pull_request_review_comment: ${footerConfig}`); | ||||||||||||||
| } else if (config.submit_pull_request_review?.footer !== undefined) { | ||||||||||||||
| footerConfig = config.submit_pull_request_review.footer; | ||||||||||||||
| core.info(`Using footer config from submit_pull_request_review: ${footerConfig}`); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| if (footerConfig !== undefined) { | ||||||||||||||
| prReviewBuffer.setFooterMode(footerConfig); | ||||||||||||||
|
||||||||||||||
| prReviewBuffer.setFooterMode(footerConfig); | |
| let normalizedFooterConfig = footerConfig; | |
| if (typeof footerConfig === "boolean") { | |
| normalizedFooterConfig = footerConfig ? "always" : "none"; | |
| } | |
| prReviewBuffer.setFooterMode(normalizedFooterConfig); |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -982,9 +982,21 @@ async function main() { | |||||||||||||||
| // Create the shared PR review buffer instance (no global state) | ||||||||||||||||
| const prReviewBuffer = createReviewBuffer(); | ||||||||||||||||
|
|
||||||||||||||||
| // Apply footer config from submit_pull_request_review (if configured) | ||||||||||||||||
| if (configs.regular?.submit_pull_request_review?.footer === false) { | ||||||||||||||||
| prReviewBuffer.setIncludeFooter(false); | ||||||||||||||||
| // Apply footer config with priority: | ||||||||||||||||
| // 1. create_pull_request_review_comment.footer (highest priority) | ||||||||||||||||
| // 2. submit_pull_request_review.footer (fallback) | ||||||||||||||||
| // 3. Default: "always" | ||||||||||||||||
| let footerConfig = undefined; | ||||||||||||||||
| if (configs.regular?.create_pull_request_review_comment?.footer !== undefined) { | ||||||||||||||||
| footerConfig = configs.regular.create_pull_request_review_comment.footer; | ||||||||||||||||
| core.info(`Using footer config from create_pull_request_review_comment: ${footerConfig}`); | ||||||||||||||||
| } else if (configs.regular?.submit_pull_request_review?.footer !== undefined) { | ||||||||||||||||
| footerConfig = configs.regular.submit_pull_request_review.footer; | ||||||||||||||||
| core.info(`Using footer config from submit_pull_request_review: ${footerConfig}`); | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| if (footerConfig !== undefined) { | ||||||||||||||||
|
||||||||||||||||
| 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}`); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setIncludeFooteris labeled as a backward-compatibility alias, but it now points tosetFooterModeand no longer supports the previous boolean contract. Any remaining callers passingfalsewill hit the "invalid type" path and silently reset to the default "always" (re-enabling the footer). Consider keepingsetIncludeFooter(value: boolean)semantics by mapping booleans to modes (false→"none", true→"always"), while keepingsetFooterMode(value: string)as the new string-only API.