Add create-agent-task safe output and GH_AW_COPILOT_TOKEN support#2029
Add create-agent-task safe output and GH_AW_COPILOT_TOKEN support#2029
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…kflow Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Agentic Changeset Generator triggered by this pull request. |
| base: main | ||
| --- | ||
|
|
||
| # Example: Create Agent Task |
There was a problem hiding this comment.
Moved to pkg/cli/workflows/test-copilot-create-agent-task.md
Commit: [commit hash will be in the next response after git push]
There was a problem hiding this comment.
Moved to pkg/cli/workflows/test-copilot-create-agent-task.md
Commit: 0e0328e
…example to test workflows Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done! Added create_agent_task handling to collect_ndjson_output.cjs:
Commit: [commit hash will be in the next response after git push]
Done! Added create_agent_task handling to collect_ndjson_output.cjs:
Commit: 0e0328e |
|
@copilot update dev.md to start with workflow dispatch and create an agentic task that writes a poem in code |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Updated dev.md to use create-agent-task with workflow_dispatch trigger. The workflow now creates an agent task that writes a poem in code, with instructions for creative coding that expresses poetry through programming constructs. Commit: (will be available after push completes)
Updated dev.md to use create-agent-task with workflow_dispatch trigger. The workflow now creates an agent task that writes a poem in code, with instructions for creative coding that expresses poetry through programming constructs. Commit: 741027c |
|
@copilot simple dev.md prompt to generate a poem of 3 words. Use Claude engine. |
🎨 Code Poetry Workflow CreatedI've successfully created a new GitHub Copilot agentic workflow called Code Poetry Generator that writes poetry expressed in code. What Was CreatedFile: This workflow creates poems where the code itself is the artistic medium - combining valid, runnable code with poetic expression. Key Features
Example IncludedThe workflow includes a complete example of a Python Fibonacci Haiku that demonstrates:
Security Features
Next Steps Required
make recompile
# or
./gh-aw compile code-poetryDue to permission restrictions in the current environment, I cannot run the compilation step. A maintainer will need to:
Usage ExamplesOnce compiled, users can trigger it via: Command in Issue: Manual Dispatch:
Expected Output:
Differences from Existing poem-botThe existing Status: ✅ Workflow created successfully |
✅ Dev Hawk Report - SuccessWorkflow Run: #2942
SummaryThe Dev workflow completed successfully! 🎉 This run validated the changes to add the "create-agent-task" safe output functionality, including:
What was tested
All checks passed successfully. The implementation is ready for review! 🚀
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed! Added create-agent-task handling to Commit: (will be available after push completes)
Fixed! Added create-agent-task handling to Commit: 28fde79 |
✅ Dev Hawk Report - SuccessWorkflow Run: #2945
The Dev workflow completed successfully! 🎉 SummaryAll checks passed for the latest commit:
This validates that the recent changes to include
|
| github: | ||
|
|
||
| safe-outputs: | ||
| staged: true |
There was a problem hiding this comment.
Removed staged mode from dev.md.
Commit: (will be available after push completes)
There was a problem hiding this comment.
Removed staged mode from dev.md.
Commit: cb4395a
| } | ||
|
|
||
| core.summary.addRaw(summaryContent); | ||
| await core.summary.write(); |
There was a problem hiding this comment.
Added core.info(summaryContent) to print summary to logs in both staged and regular modes.
Commit: (will be available after push completes)
There was a problem hiding this comment.
Added core.info(summaryContent) to print summary to logs in both staged and regular modes.
Commit: cb4395a
| const targetRepo = process.env.GITHUB_AW_TARGET_REPO; | ||
|
|
||
| // Process the first agent task item (max is 1) | ||
| const taskItem = createAgentTaskItems[0]; |
There was a problem hiding this comment.
Updated to iterate through all task items with proper error handling and logging for each task.
Commit: (will be available after push completes)
There was a problem hiding this comment.
Updated to iterate through all task items with proper error handling and logging for each task.
Commit: cb4395a
…l task items Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
|
@copilot add support for a special secret GH_AW_COPILOT_TOKEN that will be used for copilot safe outputs (assign copilot to issue, assign copilot reviewer, create agent task) The secret preference should be
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Added GH_AW_COPILOT_TOKEN support with the requested precedence:
Applied to:
Commit: (will be available after push completes)
Added GH_AW_COPILOT_TOKEN support with the requested precedence:
Applied to:
Commit: 459816a |
|
@copilot merge main recompile finish merge |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Completed merge, recompile, and finish:
Commit: (will be available after push completes)
Completed merge, recompile, and finish:
Commit: 87285b7 |
|
@copilot merge main recompile finish merge |
…ent-task-output # Conflicts: # .github/workflows/brave.lock.yml # .github/workflows/cli-version-checker.lock.yml # .github/workflows/copilot-agent-analysis.lock.yml # .github/workflows/daily-doc-updater.lock.yml # .github/workflows/dev.lock.yml # .github/workflows/duplicate-code-detector.lock.yml # .github/workflows/github-mcp-tools-report.lock.yml # .github/workflows/pdf-summary.lock.yml # .github/workflows/plan.lock.yml # .github/workflows/poem-bot.lock.yml # .github/workflows/q.lock.yml # .github/workflows/scout.lock.yml # .github/workflows/security-fix-pr.lock.yml # .github/workflows/technical-doc-writer.lock.yml # .github/workflows/tidy.lock.yml # .github/workflows/unbloat-docs.lock.yml # pkg/workflow/compiler.go # pkg/workflow/js/check_command_position.cjs # pkg/workflow/js/check_command_position.test.cjs # pkg/workflow/js/create_issue.test.cjs # pkg/workflow/js/create_pull_request.test.cjs # pkg/workflow/js/sanitize_output.cjs # pkg/workflow/js/sanitize_output.test.cjs
…all workflows Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Completed second merge, recompile, and finish:
Commit: (will be available after push completes)
Completed second merge, recompile, and finish:
Commit: 2bf6ccc |
Add create-agent-task safe output ✅
This PR adds a new "create-agent-task" safe output that uses the
gh agent-task createCLI to start a new GitHub Copilot agent task, along with support for a specialGH_AW_COPILOT_TOKENsecret for Copilot-related operations.Summary of Changes
Core Implementation:
CreateAgentTaskConfigstruct for configurationparseAgentTaskConfigto parse frontmatter configurationbuildCreateOutputAgentTaskJobto generate the GitHub Actions jobextractSafeOutputsConfigto handle create-agent-taskHasSafeOutputsEnabledto include create-agent-taskgenerateSafeOutputsPromptSectionbuildSafeOutputsJobsIntegration:
main_workflow_schema.jsoncommands.goandinteractive.gocreate_agent_task.cjs)js.gocollect_ndjson_output.cjsto handle create_agent_task messagesgenerateSafeOutputsConfigto include create-agent-task in GITHUB_AW_SAFE_OUTPUTS_CONFIGToken Management:
GH_AW_COPILOT_TOKENsupport with proper precedence chaingetEffectiveCopilotGitHubToken()function for Copilot-specific token resolutionTesting:
test-copilot-create-agent-task.md)Documentation:
pkg/cli/workflows/test-copilot-create-agent-task.mddev.mdworkflow to demonstrate create-agent-task usageImplementation Details
The create-agent-task safe output:
Configuration Options:
base: Base branch for the agent task PR (defaults to current branch)target-repo: Target repository for cross-repo tasks (format:owner/repo)max: Maximum number of tasks (limited to 1)min: Minimum number of tasks (0-1)github-token: Custom GitHub tokenWorkflow Job:
gh agent-task create --from-file --base <branch> [--repo <repo>]task_numberandtask_urlPermissions:
contents: write- For gh CLI operationsissues: write- For task creation (tasks are issues)pull-requests: write- For PR creationSecurity:
Token Precedence for Copilot Operations:
secrets.GH_AW_COPILOT_TOKEN(Copilot-specific token)secrets.GH_AW_GITHUB_TOKEN(general GitHub token)secrets.GITHUB_TOKEN(default GitHub Actions token)This precedence applies to:
Example Usage
Files Modified
Core Workflow Files:
pkg/workflow/create_agent_task.go(new)pkg/workflow/js/create_agent_task.cjs(new)pkg/workflow/js/collect_ndjson_output.cjs(updated)pkg/workflow/compiler.gopkg/workflow/safe_outputs.gopkg/workflow/safe_output_helpers.go(updated)pkg/workflow/js.gopkg/workflow/js/safe_outputs_mcp_server.cjspkg/workflow/github_token.go(updated - added Copilot token support)pkg/workflow/parse_utils.go(updated - added Copilot token helper)pkg/workflow/create_issue.go(updated - Copilot token for assignees)pkg/workflow/create_pull_request.go(updated - Copilot token for reviewers)Schema & CLI:
pkg/parser/schemas/main_workflow_schema.jsonpkg/cli/commands.gopkg/cli/interactive.goTests:
pkg/workflow/create_agent_task_test.go(new)pkg/workflow/create_agent_task_integration_test.go(new)pkg/cli/workflows/test-copilot-create-agent-task.md(new)pkg/workflow/js/create_issue.test.cjs(updated - empty output expectations)pkg/workflow/js/create_pull_request.test.cjs(updated - empty output expectations)Example Workflows:
.github/workflows/dev.md(updated - simple 3-word poem prompt with Claude engine)Recent Updates
create_agent_taskcase togetMaxAllowedForType()in collect_ndjson_output.cjscreate_agent_taskrequiringbodyfieldtest-copilot-create-agent-task.mddev.mdworkflow to generate a 3-word poem using Claude enginegenerateSafeOutputsConfigto includecreate_agent_taskin GITHUB_AW_SAFE_OUTPUTS_CONFIGNext Steps
Ready for review and merge! The implementation is complete with:
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.