-
Notifications
You must be signed in to change notification settings - Fork 128
Add update-discussion safe output type #6887
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
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Update dev.md to add a poem to the latest discussion @copilot |
- Added update-discussion entry to main_workflow_schema.json - Updated safe-outputs comment to include update-discussion - Modified dev.md to test update-discussion by adding a poem to the latest discussion - Rebuilt binary to embed updated schema Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Updated dev.md to add a poem to the latest discussion using the new update-discussion safe output type. The workflow now:
Changes in commit c937d5e. |
- Added GH_AW_UPDATE_TITLE and GH_AW_UPDATE_BODY environment variables based on config - Added GH_AW_UPDATE_TARGET environment variable if target is specified - These env vars control which fields the JavaScript update_runner allows to be updated - Recompiled dev.md workflow to include GH_AW_UPDATE_BODY: "true" Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot merge main |
|
Resolved conflicts in lock files: - campaign-generator.lock.yml - dev.lock.yml - poem-bot.lock.yml - sub-issue-closer.lock.yml Recompiled workflows after merge to ensure update-discussion implementation is preserved.
- Resolved conflicts in 4 lock files (campaign-generator, dev, poem-bot, sub-issue-closer) - Rebuilt binary with latest changes from main - Recompiled workflows to preserve update-discussion implementation - Verified update-discussion step in dev.lock.yml has correct environment variables - All tests passing Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot update dev.md and insist to update an issue with a poem in the body. |
✅ Dev Hawk Report - SuccessWorkflow Run: #3142
The Dev workflow completed successfully! 🎉 Workflow DetailsThis run tested the update-discussion feature after merging the main branch. The workflow execution included:
All steps completed without errors, confirming that the merge and environment variable fixes are working correctly.
|
- Changed workflow to update an issue with a poem instead of a discussion - Updated permissions from discussions:write to issues:write - Changed toolsets from [discussions] to [issues] - Updated safe-outputs from update-discussion to update-issue - Added explicit instruction that the agent MUST use update_issue tool - Recompiled dev.lock.yml with the update-issue step Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Updated dev.md to use update-issue instead of update-discussion. The workflow now:
Changes in commit 3935612. |
|
Update dev.md to use upda-discussion NOT ISSUE |
✅ Dev Hawk Report - SuccessWorkflow Run: #3148
The Dev workflow completed successfully! 🎉 This validates the merge from
|
|
@copilot the tool handler does not seem to be enabled or handled in the safe output MCP server https://github.com/githubnext/gh-aw/actions/runs/20359439328/job/58501762301#step:37:1 |
- Fixed YAML tag in compiler_types.go from "update-discussions" (plural) to "update-discussion" (singular) to match schema - Added UpdateDiscussions handling to generateSafeOutputsConfig function so the config JSON includes update_discussion - This ensures the MCP server receives the configuration and properly registers the update_discussion tool - Recompiled dev.lock.yml which now includes update_discussion in config.json The root cause was that update-discussion configuration wasn't being written to the config.json file that the MCP server reads, so even though the tool was defined, the server didn't register it. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed the tool handler issue. The root cause was:
Without the config entry, the MCP server never registered the tool, even though it was defined in tools.json. The default handler works correctly for tools without explicit handlers - the issue was the tool wasn't being registered at all. Changes in commit 5d6b3cd. |
✅ Dev Hawk Report - SuccessWorkflow Run: #3149
The Dev workflow completed successfully! 🎉 SummaryThis run validated the latest bug fix for MCP server tool registration:
All checks passed successfully, confirming that the update-discussion tool will now be properly registered by the MCP server.
|
|
@copilot update dev.md update-discussion to target * |
- Added target: "*" to update-discussion configuration in dev.md - This allows the agent to update any discussion, not just the triggering one - Compiled workflow now includes GH_AW_UPDATE_TARGET: "*" environment variable - Agent can now specify discussion_number when calling update_discussion tool Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Updated dev.md to set The compiled workflow now includes Changes in commit 6520930. |
|
|
@copilot update graphql query to handle missing title/body See https://github.com/githubnext/gh-aw/actions/runs/20360201041/job/58504087589#step:5:1 |
- Added validation to ensure at least one field (title or body) is provided - Fixed GraphQL mutation to dynamically build mutation fields based on what's being updated - Changed mutation parameters to use required types (String!) for provided fields - Built mutation field list dynamically to avoid invalid GraphQL syntax - All 8 update_discussion tests passing - Recompiled all 116 workflows successfully The previous implementation would create invalid GraphQL when fields were conditionally included, resulting in malformed mutation syntax. The fix properly constructs the mutation string and variables based on which fields are actually being updated. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed the GraphQL mutation handling. The issue was that the mutation was building invalid GraphQL syntax when fields were conditionally included. Changes made:
The mutation now correctly handles all cases: title only, body only, or both fields. Changes in commit e4f9122. |
✅ Dev Hawk Report - SuccessWorkflow Run: #3151
SummaryThe Dev workflow completed successfully! 🎉 This run validated the GraphQL mutation fix for update-discussion, which now properly handles cases when title or body fields are missing by dynamically building the mutation structure. What Was Tested
The implementation correctly prevents invalid GraphQL syntax by building mutation fields and parameters based on which fields are actually being updated.
|
|
@copilot include a footer that points to the workflow run similarly to other generated messages. |
- Imported generateFooter from generate_footer.cjs - When updating discussion body, append footer with workflow name and run URL - Footer includes triggering issue/PR/discussion number if available - Matches footer format used by other safe output types (create_issue, etc.) - All 8 update_discussion tests passing - Compiled dev.lock.yml now includes footer generation logic The footer provides traceability by showing which workflow run made the update, consistent with other safe output types. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Added footer generation to update-discussion body updates. The footer is automatically appended when updating a discussion body and includes:
Format matches other safe output types: Changes in commit 2acbef7. |
Add update-discussion Safe Output Type - COMPLETE ✅
Successfully implemented a new "update-discussion" safe output type that allows updating GitHub discussions similar to update-issue.
Recent Changes
Footer Addition (Latest)
Bug Fix: GraphQL Mutation Handling
Target Configuration Update
target: "*"for update-discussionBug Fix: MCP Server Tool Registration
update-discussions(plural) toupdate-discussion(singular) to match schemagenerateSafeOutputsConfig()functionupdate_discussionso the MCP server properly registers the toolMain Branch Merge (2nd merge)
Main Branch Merge (First merge)
Permissions Fix
discussions: writetodiscussions: readDev Workflow Update
.github/workflows/dev.mdto useupdate-discussionto test the new functionalityupdate-discussionsafe output with body updates enabledBug Fix: Environment Variables
buildUpdateDiscussionStepConfigto properly setGH_AW_UPDATE_TITLEandGH_AW_UPDATE_BODYenvironment variablesupdate_runnerSchema Update
update-discussiontomain_workflow_schema.jsonwith proper validationImplementation Checklist - All Complete ✅
How It Works
The new safe output type allows AI agents to update existing GitHub discussions by:
Example usage in a workflow:
When
target: "*"is set, the agent must specify thediscussion_numberwhen calling theupdate_discussiontool. This provides flexibility to target specific discussions rather than being limited to the triggering discussion.The JavaScript implementation uses environment variables (
GH_AW_UPDATE_TITLE,GH_AW_UPDATE_BODY,GH_AW_UPDATE_TARGET) to control which fields can be updated and how discussions are targeted, matching the pattern used by other update operations. Write permissions are handled by the safe-outputs job, maintaining proper separation of concerns.The GraphQL mutation is dynamically constructed based on which fields are being updated, ensuring valid GraphQL syntax and proper type handling.
When updating the discussion body, a footer is automatically appended:
This provides traceability and matches the footer format used by other safe output types like create_issue and create_discussion.
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.