Skip to content

feat: add footer: false support to add-comment safe output#18942

Merged
pelikhan merged 3 commits intomainfrom
copilot/add-suppress-generated-text-option
Mar 1, 2026
Merged

feat: add footer: false support to add-comment safe output#18942
pelikhan merged 3 commits intomainfrom
copilot/add-suppress-generated-text-option

Conversation

Copy link
Contributor

Copilot AI commented Feb 28, 2026

  • Add Footer field to AddCommentsConfig struct in Go
  • Pass footer to add_comment config builder in compiler_safe_outputs_config.go
  • Add footer check in add_comment.cjs JavaScript file
  • Add footer field to add-comment JSON schema (placed before github-token, consistent with all other handlers)
  • Add tests for add-comment footer configuration
  • Add FAQ entry in faq.md about suppressing "Generated by..." text
  • Add footer tip to add-comment section in safe-outputs.md
  • Run tests and validation (make fmt, make lint, make build, make recompile)
  • Reviewed existing footer/order field patterns — implementation follows same conventions as all other handlers (create-issue, create-pull-request, create-discussion, etc.)
Original prompt

This section details on the original issue you should resolve

<issue_title>Feature Request: Option to suppress "Generated by..." text</issue_title>
<issue_description>When agentic workflows operate and modify the content of issues (and I'm assuming PRs, but I haven't had them do anything in PRs yet to confirm) they post a line in the issue comment body that identifies that the text was modified/updated by the various agentic workflows leveraged. This was super helpful when I was running one agentic workflow to modify content of the issues, but as the number of workflows has increased, the number of "Generated by..." lines. An option to either suppress it via the UI or to be able to tell agentic workflows to limit/not display the Generated by content would be ideal.

Image</issue_description>

Comments on the Issue (you are @copilot in this section)

@pelikhan At @copilot, the user can use the `footer: false` syntax in safe-outputs to disable adding footers. We should create an FAQ entry that answers the question in this issue and shows how the configuration is written. We should also add documentation about the `footer` field in safe-outputs, and update the various locations where we describe or use safe-outputs to mention this option. @pelikhan We used a technical writer sub-agent to improve the documentation quality and ensure consistency across all gh-aw workflow descriptions.

💡 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.

@pelikhan
Copy link
Contributor

@copilot, review all existing order fields and footer fields and their usage. Ensure you are not reinventing functionality that already exists.

- Add Footer field to AddCommentsConfig struct with preprocessing
- Pass footer to add_comment handler config builder (respects global footer setting)
- Add footer check in add_comment.cjs: conditionally add footer or just XML marker
- Add footer field to add-comment JSON schema
- Add tests for add-comment footer configuration (per-handler and global inheritance)
- Add FAQ entry about suppressing Generated by... text
- Add footer tip to add-comment section in safe-outputs.md

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add option to suppress 'Generated by...' text in comments feat: add footer: false support to add-comment safe output Feb 28, 2026
…tency

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 28, 2026

@copilot, review all existing order fields and footer fields and their usage. Ensure you are not reinventing functionality that already exists.

Reviewed all existing footer fields and their usage across create-issue, create-pull-request, create-discussion, update-issue, update-discussion, update-pull-request, update-release, and reply-to-pull-request-review-comment. The add-comment handler was the only one missing footer support — the implementation follows the exact same conventions as all other handlers:

  • Go struct: Footer *string with preprocessBoolFieldAsString (same as create-issue)
  • Config builder: AddTemplatableBool("footer", getEffectiveFooterForTemplatable(c.Footer, cfg.Footer)) (identical to all other handlers)
  • JS: parseBoolTemplatable(config.footer, true) with if (includeFooter) guard (same as create-issue.cjs, create-pull-request.cjs, create-discussion.cjs)
  • Schema: fixed in 21c1faf to place footer before github-token, consistent with all other handler schemas

@pelikhan pelikhan marked this pull request as ready for review February 28, 2026 23:59
Copilot AI review requested due to automatic review settings February 28, 2026 23:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds footer: false support to the add-comment safe output handler, allowing users to suppress the "Generated by..." attribution line when posting comments, while preserving hidden XML markers for searchability.

Changes:

  • Adds Footer *string field to AddCommentsConfig Go struct, with corresponding YAML schema validation and handler config builder wiring.
  • Implements includeFooter logic in add_comment.cjs, using generateXMLMarker when footer: false.
  • Adds tests, documentation (FAQ entry and safe-outputs reference tip) for the new footer: false option on add-comment.

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/add_comment.go Adds Footer *string field to AddCommentsConfig struct; preprocesses boolean field before YAML unmarshal
pkg/workflow/compiler_safe_outputs_config.go Wires footer field into add_comment handler config builder using getEffectiveFooterForTemplatable
pkg/workflow/safe_outputs_footer_test.go Adds Go tests for add-comment footer configuration and global footer propagation
pkg/parser/schemas/main_workflow_schema.json Adds footer boolean field to add-comment JSON schema definition
actions/setup/js/add_comment.cjs Implements runtime includeFooter logic using parseBoolTemplatable; adds generateXMLMarker import
docs/src/content/docs/reference/safe-outputs.md Adds footer: false to the example config block and a TIP callout
docs/src/content/docs/reference/faq.md Adds new FAQ entry explaining how to suppress the "Generated by..." footer text

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +66 to +82
for _, step := range steps {
if strings.Contains(step, "GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG") {
parts := strings.Split(step, "GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: ")
if len(parts) == 2 {
jsonStr := strings.TrimSpace(parts[1])
jsonStr = strings.Trim(jsonStr, "\"")
jsonStr = strings.ReplaceAll(jsonStr, "\\\"", "\"")
var handlerConfig map[string]any
err := json.Unmarshal([]byte(jsonStr), &handlerConfig)
require.NoError(t, err)

addCommentConfig, ok := handlerConfig["add_comment"].(map[string]any)
require.True(t, ok, "add_comment handler config should exist")
assert.Equal(t, false, addCommentConfig["footer"], "add_comment should inherit global footer: false")
}
}
}
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test in the "global footer: false propagates to add-comment" sub-test iterates over steps to find the GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG env var, but unlike the analogous TestGlobalFooterConfiguration test (line 116), there is no require.Contains guard before the loop to fail the test if no matching step is found. If addHandlerManagerConfigEnvVar emits no steps containing GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG, the loop body (including the require.True(t, ok, ...) assertion) is never reached, and the test passes vacuously. A guard like require.Contains(t, strings.Join(steps, ""), "GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG") should be added before the loop, as is done in the adjacent TestGlobalFooterConfiguration test.

Copilot uses AI. Check for mistakes.
Comment on lines +531 to +534
} else {
// When footer is disabled, only add XML marker for searchability (no visible attribution text)
processedBody += "\n\n" + generateXMLMarker(workflowName, runUrl);
}
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When footer: false, the other handlers (create_issue.cjs, create_pull_request.cjs, create_discussion.cjs) consistently add a generateWorkflowIdMarker (from generate_footer.cjs), which produces <!-- gh-aw-workflow-id: ${workflowId} -->. However, the new add_comment.cjs implementation calls generateXMLMarker (from messages_footer.cjs), which produces a much more complex <!-- gh-aw-agentic-workflow: ..., workflow_id: ..., run: ... --> marker.

This inconsistency also conflicts with the documentation added in faq.md (line 286), which explicitly states that <!-- gh-aw-workflow-id: ... --> will still be included for searchability. The actual marker format added by add_comment.cjs with footer: false uses gh-aw-agentic-workflow: as the prefix (not gh-aw-workflow-id:), and also includes the workflow_id: field only conditionally if GH_AW_WORKFLOW_ID is set.

To be consistent with other handlers and with the documentation, the footer: false path in add_comment.cjs should use the same approach as create_issue.cjs and create_pull_request.cjs: check if (workflowId) and add generateWorkflowIdMarker(workflowId) (imported from generate_footer.cjs).

Copilot uses AI. Check for mistakes.
},
"footer": {
"type": "boolean",
"description": "Controls whether AI-generated footer is added to the comment. When false, the visible footer content is omitted but XML markers (workflow-id, metadata) are still included for searchability. Defaults to true.",
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The footer field description for add-comment says "XML markers (workflow-id, metadata)" but the equivalent description for create_issue's footer field says "XML markers (workflow-id, tracker-id, metadata)". Since add_comment.cjs also adds a tracker-id marker (regardless of the footer setting), the description should mention "tracker-id" as well, to be accurate and consistent.

Suggested change
"description": "Controls whether AI-generated footer is added to the comment. When false, the visible footer content is omitted but XML markers (workflow-id, metadata) are still included for searchability. Defaults to true.",
"description": "Controls whether AI-generated footer is added to the comment. When false, the visible footer content is omitted but XML markers (workflow-id, tracker-id, metadata) are still included for searchability. Defaults to true.",

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan merged commit e2f9611 into main Mar 1, 2026
81 checks passed
@pelikhan pelikhan deleted the copilot/add-suppress-generated-text-option branch March 1, 2026 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Option to suppress "Generated by..." text

3 participants