Skip to content

Comments

Auto-generate sanitized step for issue/discussion/PR/comment contexts#16378

Merged
pelikhan merged 9 commits intomainfrom
copilot/review-sanitized-step-logic
Feb 17, 2026
Merged

Auto-generate sanitized step for issue/discussion/PR/comment contexts#16378
pelikhan merged 9 commits intomainfrom
copilot/review-sanitized-step-logic

Conversation

Copy link
Contributor

Copilot AI commented Feb 17, 2026

Completed: Fix sanitized step generation for issue/discussion/PR/comment contexts

  • Understand current implementation
  • Create helper function to detect context-based triggers
  • Update sanitized step generation logic
  • Add comprehensive tests
  • Address feedback: Add slash_command and labeled detection
  • Update references from needs.activation.outputs to steps.sanitized.outputs
  • Final validation

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

  • Core logic: compiler_orchestrator_tools.go, compiler_activation_jobs.go, expression_extraction.go
  • Tests: 15 test files updated to use new steps.sanitized.outputs.* API
  • Total changes: 18 files, ~120 lines changed

All commits are clean, tests pass, and the implementation is fully backward compatible.

Original prompt

Review the logic to generate the "sanitized" step and ensure that it gets added if the workflow has an issue/discussion/pr/comment context .


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 17, 2026 15:14
- 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>
Copilot AI changed the title [WIP] Review logic to add sanitized step for contexts Auto-generate sanitized step for issue/discussion/PR/comment contexts Feb 17, 2026
Copilot AI requested a review from pelikhan February 17, 2026 15:21
- 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>
Copy link
Contributor Author

Copilot AI commented Feb 17, 2026

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:

  • https://api.github.com/user
    • Triggering command: /usr/bin/gh gh api user --jq .login (http block)

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>
@pelikhan pelikhan marked this pull request as ready for review February 17, 2026 16:13
Copilot AI review requested due to automatic review settings February 17, 2026 16:13
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 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.* to steps.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.

@pelikhan
Copy link
Contributor

@copilot keep working

Copy link
Contributor Author

Copilot AI commented Feb 17, 2026

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:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw -nolocalimports -importcfg git 5803�� --show-toplevel 5803821/b416/_testmain.go (http block)
  • https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha 3700-10635/test-628618903 /tmp/go-build2465803821/b063/vet.cfg /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet l (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha 8956/001/stability-test.md (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha --noprofile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha vaScript99978410/001/test-complex-frontmatter-with-tools.md (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha --show-toplevel l /usr/bin/git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha 4146336759/.github/workflows .cfg 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -bool -buildtags /usr/bin/git -errorsas -ifaceassert -nilfunc git rev-�� --show-toplevel -tests /usr/bin/git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-current (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha go1.25.0 -c=4 -nolocalimports -importcfg /tmp/go-build2465803821/b390/importcfg -pack /tmp/go-build2465803821/b390/_testmain.go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha ingutil.test (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha vaScript99978410/001/test-simple-frontmatter.md (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha 00 stmain.go ache/go/1.25.0/x64/pkg/tool/linux_amd64/compile (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 100 (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 6 (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha ty-test.md (http block)
  • https://api.github.com/repos/nonexistent/repo/actions/runs/12345
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion (http block)
  • https://api.github.com/repos/owner/repo/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build2465803821/b368/cli.test /tmp/go-build2465803821/b368/cli.test -test.testlogfile=/tmp/go-build2465803821/b368/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true (http block)
  • https://api.github.com/repos/test-owner/test-repo/actions/secrets
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name (http block)
  • https://api.github.com/user
    • Triggering command: /usr/bin/gh gh api user --jq .login (http block)

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.
@pelikhan pelikhan merged commit 9016b82 into main Feb 17, 2026
49 of 50 checks passed
@pelikhan pelikhan deleted the copilot/review-sanitized-step-logic branch February 17, 2026 16:48
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.

2 participants