Skip to content

Commit d07c1af

Browse files
authored
Deprecate needs.activation.outputs.* in workflow markdown; update all docs to use steps.sanitized.outputs.* (#21682)
1 parent d1dced1 commit d07c1af

19 files changed

Lines changed: 85 additions & 96 deletions

File tree

.github/aw/create-agentic-workflow.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ These resources contain workflow patterns, best practices, safe outputs, and per
539539
- Prefer `safe-outputs` (`create-issue`, `add-comment`, `create-pull-request`, `create-pull-request-review-comment`, `update-issue` for editing, `close-issue` for closing, `dispatch-workflow`) over granting write perms.
540540
- For custom write operations to external services (email, Slack, webhooks), use `safe-outputs.jobs:` to create custom safe output jobs.
541541
- Constrain `network:` to the minimum required ecosystems/domains.
542-
- Use sanitized expressions (`${{ needs.activation.outputs.text }}`) instead of raw event text.
542+
- Use sanitized expressions (`${{ steps.sanitized.outputs.text }}`) instead of raw event text.
543543
- **Emphasize human agency in workflow prompts**:
544544
- When writing prompts that report on repository activity (commits, PRs, issues), always attribute bot activity to humans
545545
- **@github-actions[bot]** and **@Copilot** are tools triggered by humans - workflows should identify who triggered, reviewed, or merged their actions
@@ -571,14 +571,14 @@ safe-outputs:
571571
# Deploy Preview
572572
573573
Deploy a preview environment for this pull request. The caller wrote:
574-
"${{ needs.activation.outputs.text }}"
574+
"${{ steps.sanitized.outputs.text }}"
575575
```
576576

577577
**Tradeoffs:**
578578
- ✅ Works across issues, PRs, and all comment types (configurable via `events:`)
579579
- ✅ Natural to invoke — users type `/command` in any comment
580580
- ✅ Supports multiple command aliases in one workflow (`name: ["deploy", "redeploy"]`)
581-
- ✅ The triggering comment text is available as context via `needs.activation.outputs.text`
581+
- ✅ The triggering comment text is available as context via `steps.sanitized.outputs.text`
582582
- ⚠️ Less discoverable — users must know the command name exists
583583
- ⚠️ Cannot be triggered without writing a comment (no label-based invocation)
584584

.github/aw/github-agentic-workflows.md

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/aw/update-agentic-workflow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ When updating workflows, maintain security:
273273
- Default to `permissions: read-all` and expand only if necessary
274274
- Prefer `safe-outputs` over granting write permissions
275275
- Constrain `network:` to the minimum required ecosystems/domains
276-
- Use sanitized expressions (`${{ needs.activation.outputs.text }}`)
276+
- Use sanitized expressions (`${{ steps.sanitized.outputs.text }}`)
277277

278278
## Update Workflow Process
279279

.github/copilot/instructions/workflow-performance.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ on:
4747
types: [opened]
4848
---
4949

50-
# Analyze issue: "${{ needs.activation.outputs.text }}"
50+
# Analyze issue: "${{ steps.sanitized.outputs.text }}"
5151
```
5252

5353
**Benefits**:
@@ -95,7 +95,7 @@ tools:
9595
```markdown
9696
Repository: ${{ github.repository }}
9797
Issue Number: ${{ github.event.issue.number }}
98-
Issue Content: "${{ needs.activation.outputs.text }}"
98+
Issue Content: "${{ steps.sanitized.outputs.text }}"
9999

100100
Analyze the above issue (content already provided).
101101
```
@@ -158,7 +158,7 @@ on: issues
158158

159159
# Issue Triage for #${{ github.event.issue.number }}
160160

161-
**Issue Content**: "${{ needs.activation.outputs.text }}"
161+
**Issue Content**: "${{ steps.sanitized.outputs.text }}"
162162

163163
Tasks:
164164
1. Categorize issue type (bug/feature/question)
@@ -352,11 +352,11 @@ Annual cost (500 runs): ~$75
352352
Get the full issue details, then summarize the description.
353353
```
354354

355-
**Problem**: Fetches large response just to extract what's already in `needs.activation.outputs.text`.
355+
**Problem**: Fetches large response just to extract what's already in `steps.sanitized.outputs.text`.
356356

357357
**Solution**:
358358
```markdown
359-
Issue: "${{ needs.activation.outputs.text }}"
359+
Issue: "${{ steps.sanitized.outputs.text }}"
360360
Summarize the above issue content.
361361
```
362362

@@ -409,7 +409,7 @@ grep -A5 "token_usage" logs/*.log
409409
```
410410

411411
**Solution**:
412-
1. Replace API calls with `needs.activation.outputs.text`
412+
1. Replace API calls with `steps.sanitized.outputs.text`
413413
2. Reduce tool permissions to minimum
414414
3. Add explicit "don't re-fetch" instructions
415415

@@ -446,4 +446,4 @@ grep "turn" logs/*.log | wc -l
446446
- Issue #1728: Token usage optimization case study (481k → 150k)
447447
- Issue #2012: Workflow performance analysis patterns
448448
- `gh aw logs` documentation: Analyzing workflow execution
449-
- Sanitized context text: Using `needs.activation.outputs.text`
449+
- Sanitized context text: Using `steps.sanitized.outputs.text`

AGENTS.md

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -772,40 +772,35 @@ go test -race ./...
772772

773773
### Expression Transformations in Workflows
774774

775-
**Automatic Activation Output Transformations:**
775+
**Deprecated: `needs.activation.outputs.*` in Workflow Markdown**
776776

777-
The compiler automatically transforms certain `needs.activation.outputs.*` expressions to `steps.sanitized.outputs.*` for compatibility with the activation job context.
777+
Use `steps.sanitized.outputs.text/title/body` directly in workflow markdown prompts:
778778

779-
**Why this transformation occurs:**
779+
- `${{ steps.sanitized.outputs.text }}` — sanitized full context
780+
- `${{ steps.sanitized.outputs.title }}` — sanitized issue/PR title
781+
- `${{ steps.sanitized.outputs.body }}` — sanitized issue/PR body
780782

781-
The prompt is generated **within the activation job**, which means it cannot reference its own `needs.activation.*` outputs (a job cannot reference its own needs outputs in GitHub Actions). The compiler automatically rewrites these expressions to reference the `sanitized` step, which computes sanitized versions of the triggering content.
783+
**Why the `steps.sanitized.*` form is required:**
782784

783-
**Transformations:**
785+
The prompt is generated **within the activation job**, which means it cannot reference its own `needs.activation.*` outputs (a job cannot reference its own needs outputs in GitHub Actions). The `sanitized` step within the activation job computes sanitized versions of the triggering content.
786+
787+
**Backward compatibility:**
788+
789+
The compiler still accepts the old form (`needs.activation.outputs.text/title/body`) and automatically rewrites it to `steps.sanitized.outputs.*`, but emits a deprecation warning. Use `steps.sanitized.outputs.*` directly in all new and updated workflows.
790+
791+
**Old deprecated form → new correct form:**
784792
- `needs.activation.outputs.text``steps.sanitized.outputs.text`
785793
- `needs.activation.outputs.title``steps.sanitized.outputs.title`
786794
- `needs.activation.outputs.body``steps.sanitized.outputs.body`
787795

788796
**Important notes:**
789-
- Only `text`, `title`, and `body` outputs are transformed
790-
- Other activation outputs (`comment_id`, `comment_repo`, `slash_command`) are NOT transformed
791-
- Transformation uses word boundary checking to prevent incorrect partial matches (e.g., `text_custom` is not transformed)
792-
- This is particularly important for runtime-import, where markdown can change without recompilation
793-
794-
**Example:**
795-
796-
```markdown
797-
Analyze this content: "${{ needs.activation.outputs.text }}"
798-
```
799-
800-
Is automatically transformed to:
801-
802-
```markdown
803-
Analyze this content: "${{ steps.sanitized.outputs.text }}"
804-
```
797+
- Only `text`, `title`, and `body` outputs are affected; use `needs.activation.outputs.*` for `comment_id`, `comment_repo`, `slash_command` etc. in _downstream_ jobs
798+
- Backward-compat transformation uses word boundary checking (e.g., `text_custom` is not transformed)
805799

806800
**Implementation:**
807801
- Transformation happens in `pkg/workflow/expression_extraction.go::transformActivationOutputs()`
808802
- Applied during expression extraction from markdown
803+
- Deprecation warnings emitted to stderr during compilation
809804
- Transformations are logged for debugging when `DEBUG=workflow:expression_extraction`
810805

811806
### YAML Library Usage

docs/slides/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ safe-outputs:
345345
---
346346
# RECOMMENDED: Use sanitized context
347347
Analyze this issue content (safely sanitized):
348-
"${{ needs.activation.outputs.text }}"
348+
"${{ steps.sanitized.outputs.text }}"
349349

350350
Metadata:
351351
- Issue #${{ github.event.issue.number }}

docs/src/content/docs/examples/multi-repo/issue-tracking.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ tracking issue in the central tracker.
4545

4646
**Original issue:** ${{ github.event.issue.html_url }}
4747
**Issue number:** ${{ github.event.issue.number }}
48-
**Content:** "${{ needs.activation.outputs.text }}"
48+
**Content:** "${{ steps.sanitized.outputs.text }}"
4949

5050
Create tracking issue with link to original, component identifier, summary, suggested priority, and labels `from-component-alpha` and `tracking-issue`.
5151
```
@@ -179,7 +179,7 @@ safe-outputs:
179179
Analyze new issues and create tracking issues in appropriate repositories.
180180

181181
**Original issue:** ${{ github.event.issue.html_url }}
182-
**Content:** "${{ needs.activation.outputs.text }}"
182+
**Content:** "${{ steps.sanitized.outputs.text }}"
183183

184184
Analyze issue severity and route to appropriate tracker: security issues to `myorg/security-tracker`, features to `myorg/feature-tracker`, bugs to `myorg/bug-tracker`, or infrastructure to `myorg/ops-tracker`. Include original link, triage reasoning, priority, affected components, and SLA targets.
185185
```

docs/src/content/docs/guides/editing-workflows.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Read issue #${{ github.event.issue.number }} in repository ${{ github.repository
156156

157157
Issue title: "${{ github.event.issue.title }}"
158158

159-
Use sanitized content: "${{ needs.activation.outputs.text }}"
159+
Use sanitized content: "${{ steps.sanitized.outputs.text }}"
160160

161161
Actor: ${{ github.actor }}
162162
Repository: ${{ github.repository }}
@@ -173,7 +173,7 @@ Arbitrary expressions are blocked for security. This will fail at runtime:
173173
Run this command: ${{ github.event.comment.body }}
174174
```
175175

176-
Use `needs.activation.outputs.text` for sanitized user input instead.
176+
Use `steps.sanitized.outputs.text` for sanitized user input instead.
177177

178178
## Quick Reference
179179

docs/src/content/docs/patterns/chat-ops.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ Customize access with the `roles:` configuration. Use `roles: [admin, maintainer
7575

7676
## Accessing Context Information
7777

78-
Access sanitized event context through `needs.activation.outputs.text`:
78+
Access sanitized event context through `steps.sanitized.outputs.text`:
7979

8080
```aw wrap
8181
# Reference the sanitized text in your workflow:
82-
Analyze this content: "${{ needs.activation.outputs.text }}"
82+
Analyze this content: "${{ steps.sanitized.outputs.text }}"
8383
```
8484

8585
Sanitization filters unauthorized mentions, malicious links, and excessive content while preserving essential information.

docs/src/content/docs/patterns/issue-ops.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ safe-outputs:
4242
4343
## Accessing Issue Context
4444
45-
Access sanitized issue content through `needs.activation.outputs.text`, which combines title and description while removing security risks (@mentions, URIs, injections):
45+
Access sanitized issue content through `steps.sanitized.outputs.text`, which combines title and description while removing security risks (@mentions, URIs, injections):
4646

4747
```yaml wrap
48-
Analyze this issue: "${{ needs.activation.outputs.text }}"
48+
Analyze this issue: "${{ steps.sanitized.outputs.text }}"
4949
```
5050

5151
## Common IssueOps Patterns

0 commit comments

Comments
 (0)