Auto-generate sanitized step for issue/discussion/PR/comment contexts#16378
Auto-generate sanitized step for issue/discussion/PR/comment contexts#16378
Conversation
- Add hasContentContext() to detect workflows triggered by issue/discussion/PR/comment events - Update needsTextOutput logic to check both explicit usage and content context - Add comprehensive tests for context detection - Add integration tests verifying sanitized step is added for content-triggered workflows Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Update hasContentContext() to detect slash_command triggers - Update hasContentContext() to detect labeled activity types on issues/PRs/discussions - Add test coverage for slash_command and labeled triggers - Verify workflows with these triggers get sanitized step automatically Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…ed.outputs - Update detectTextOutputUsage to look for steps.sanitized.outputs.* instead - Update test workflows to use steps.sanitized.outputs.text directly - Update comments to reflect that users should use steps.sanitized.outputs.* - Keep transformation logic for backward compatibility with existing workflows - All tests passing with new reference pattern Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the sanitized step generation logic to automatically add the step when workflows are triggered by content events (issues, discussions, PRs, comments), regardless of explicit usage. It also transitions the API from needs.activation.outputs.* to steps.sanitized.outputs.* while maintaining backward compatibility.
Changes:
- Added
hasContentContext()function to detect workflows triggered by content events (issues, PRs, discussions, comments, slash commands, labeled events) - Updated sanitized step generation to activate when either explicitly used OR triggered by content events
- Migrated API references from
needs.activation.outputs.*tosteps.sanitized.outputs.*across test files - Added comprehensive test coverage for context detection and auto-insertion behavior
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/compiler_orchestrator_tools.go | Added hasContentContext() detection and updated detectTextOutputUsage() to check for steps.sanitized.outputs.* |
| pkg/workflow/compiler_activation_jobs.go | Updated comments to clarify new API pattern |
| pkg/workflow/expression_extraction.go | Updated comments to indicate transformation is for backward compatibility |
| pkg/workflow/compute_text_lazy_test.go | Added tests for hasContentContext() and context-based insertion |
| Multiple test files | Updated test cases to use steps.sanitized.outputs.* pattern |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot keep working |
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…zed steps - Updated multiple workflow files to include outputs for body, text, and title from the sanitized step. - Introduced a new step to compute the current body text using the compute_text action in each workflow. - Ensured that the workflows maintain permissions for issues and pull requests.
Completed: Fix sanitized step generation for issue/discussion/PR/comment contexts
Summary
Successfully implemented automatic sanitized step generation for workflows triggered by content events. The sanitized step now automatically provides text/title/body outputs for:
✅ Direct content events: issues, pull_request, pull_request_target, issue_comment, pull_request_review_comment, pull_request_review, discussion, discussion_comment
✅ Slash command triggers: workflows using
on: slash_command:✅ Labeled activity types: workflows triggered by labeled/unlabeled on issues, PRs, or discussions
API Transition
New API (recommended):
Analyze this: "${{ steps.sanitized.outputs.text }}"Legacy API (backward compatible):
Analyze this: "${{ needs.activation.outputs.text }}"Automatically transformed to steps.sanitized.outputs.text
Test Results
✅ 18 unit tests for hasContentContext (all trigger types)
✅ 7 unit tests for detectTextOutputUsage
✅ 6 integration tests for workflow compilation
✅ All existing tests passing
✅ Build successful
✅ Manual verification complete
Files Changed
All commits are clean, tests pass, and the implementation is fully backward compatible.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.