diff --git a/.github/agents/agentic-workflows.agent.md b/.github/agents/agentic-workflows.agent.md index 6ae17020830..fffe902aa68 100644 --- a/.github/agents/agentic-workflows.agent.md +++ b/.github/agents/agentic-workflows.agent.md @@ -27,7 +27,7 @@ Workflows may optionally include: - Workflow files: `.github/workflows/*.md` and `.github/workflows/**/*.md` - Workflow lock files: `.github/workflows/*.lock.yml` - Shared components: `.github/workflows/shared/*.md` -- Configuration: https://github.com/github/gh-aw/blob/main/.github/aw/github-agentic-workflows.md +- Configuration: https://github.com/github/gh-aw/blob/v0.45.4-19-gd2bbd6247/.github/aw/github-agentic-workflows.md ## Problems This Solves @@ -49,7 +49,7 @@ When you interact with this agent, it will: ### Create New Workflow **Load when**: User wants to create a new workflow from scratch, add automation, or design a workflow that doesn't exist yet -**Prompt file**: https://github.com/github/gh-aw/blob/main/.github/aw/create-agentic-workflow.md +**Prompt file**: https://github.com/github/gh-aw/blob/v0.45.4-19-gd2bbd6247/.github/aw/create-agentic-workflow.md **Use cases**: - "Create a workflow that triages issues" @@ -59,7 +59,7 @@ When you interact with this agent, it will: ### Update Existing Workflow **Load when**: User wants to modify, improve, or refactor an existing workflow -**Prompt file**: https://github.com/github/gh-aw/blob/main/.github/aw/update-agentic-workflow.md +**Prompt file**: https://github.com/github/gh-aw/blob/v0.45.4-19-gd2bbd6247/.github/aw/update-agentic-workflow.md **Use cases**: - "Add web-fetch tool to the issue-classifier workflow" @@ -69,7 +69,7 @@ When you interact with this agent, it will: ### Debug Workflow **Load when**: User needs to investigate, audit, debug, or understand a workflow, troubleshoot issues, analyze logs, or fix errors -**Prompt file**: https://github.com/github/gh-aw/blob/main/.github/aw/debug-agentic-workflow.md +**Prompt file**: https://github.com/github/gh-aw/blob/v0.45.4-19-gd2bbd6247/.github/aw/debug-agentic-workflow.md **Use cases**: - "Why is this workflow failing?" @@ -79,7 +79,7 @@ When you interact with this agent, it will: ### Upgrade Agentic Workflows **Load when**: User wants to upgrade workflows to a new gh-aw version or fix deprecations -**Prompt file**: https://github.com/github/gh-aw/blob/main/.github/aw/upgrade-agentic-workflows.md +**Prompt file**: https://github.com/github/gh-aw/blob/v0.45.4-19-gd2bbd6247/.github/aw/upgrade-agentic-workflows.md **Use cases**: - "Upgrade all workflows to the latest version" @@ -89,7 +89,7 @@ When you interact with this agent, it will: ### Create Shared Agentic Workflow **Load when**: User wants to create a reusable workflow component or wrap an MCP server -**Prompt file**: https://github.com/github/gh-aw/blob/main/.github/aw/create-shared-agentic-workflow.md +**Prompt file**: https://github.com/github/gh-aw/blob/v0.45.4-19-gd2bbd6247/.github/aw/create-shared-agentic-workflow.md **Use cases**: - "Create a shared component for Notion integration" @@ -100,7 +100,7 @@ When you interact with this agent, it will: **Load when**: Creating or updating workflows that coordinate multiple agents or dispatch work to other workflows -**Prompt file**: https://github.com/github/gh-aw/blob/main/.github/aw/orchestration.md +**Prompt file**: https://github.com/github/gh-aw/blob/v0.45.4-19-gd2bbd6247/.github/aw/orchestration.md **Use cases**: - Assigning work to AI coding agents @@ -112,7 +112,7 @@ When you interact with this agent, it will: **Load when**: Creating or updating workflows that manage GitHub Projects v2 -**Prompt file**: https://github.com/github/gh-aw/blob/main/.github/aw/projects.md +**Prompt file**: https://github.com/github/gh-aw/blob/v0.45.4-19-gd2bbd6247/.github/aw/projects.md **Use cases**: - Tracking items and fields with update-project @@ -160,7 +160,7 @@ gh aw compile --validate ## Important Notes -- Always reference the instructions file at https://github.com/github/gh-aw/blob/main/.github/aw/github-agentic-workflows.md for complete documentation +- Always reference the instructions file at https://github.com/github/gh-aw/blob/v0.45.4-19-gd2bbd6247/.github/aw/github-agentic-workflows.md for complete documentation - Use the MCP tool `agentic-workflows` when running in GitHub Copilot Cloud - Workflows must be compiled to `.lock.yml` files before running in GitHub Actions - **Bash tools are enabled by default** - Don't restrict bash commands unnecessarily since workflows are sandboxed by the AWF diff --git a/.github/workflows/ai-moderator.lock.yml b/.github/workflows/ai-moderator.lock.yml index 440f1191faf..64bb4a04721 100644 --- a/.github/workflows/ai-moderator.lock.yml +++ b/.github/workflows/ai-moderator.lock.yml @@ -64,9 +64,12 @@ jobs: contents: read issues: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" issue_locked: ${{ steps.lock-issue.outputs.locked }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -96,6 +99,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Lock issue for agent workflow id: lock-issue if: (github.event_name == 'issues') || (github.event_name == 'issue_comment') diff --git a/.github/workflows/archie.lock.yml b/.github/workflows/archie.lock.yml index 6b3d56ac625..0eda0e55a44 100644 --- a/.github/workflows/archie.lock.yml +++ b/.github/workflows/archie.lock.yml @@ -70,9 +70,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" slash_command: ${{ needs.pre_activation.outputs.matched_command }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -102,6 +105,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/auto-triage-issues.lock.yml b/.github/workflows/auto-triage-issues.lock.yml index 7c7a8f54287..cc5dbfe1744 100644 --- a/.github/workflows/auto-triage-issues.lock.yml +++ b/.github/workflows/auto-triage-issues.lock.yml @@ -56,8 +56,11 @@ jobs: permissions: contents: read outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -87,6 +90,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/brave.lock.yml b/.github/workflows/brave.lock.yml index 6a7a6d1d67d..62e3be5a7ef 100644 --- a/.github/workflows/brave.lock.yml +++ b/.github/workflows/brave.lock.yml @@ -57,9 +57,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" slash_command: ${{ needs.pre_activation.outputs.matched_command }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -89,6 +92,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/changeset.lock.yml b/.github/workflows/changeset.lock.yml index 38cd658c2f9..47ec210d0fb 100644 --- a/.github/workflows/changeset.lock.yml +++ b/.github/workflows/changeset.lock.yml @@ -65,8 +65,11 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -96,6 +99,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/cloclo.lock.yml b/.github/workflows/cloclo.lock.yml index 2cfb6649baa..938527aeeaa 100644 --- a/.github/workflows/cloclo.lock.yml +++ b/.github/workflows/cloclo.lock.yml @@ -93,9 +93,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" slash_command: ${{ needs.pre_activation.outputs.matched_command }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -125,6 +128,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/craft.lock.yml b/.github/workflows/craft.lock.yml index ef21031e945..af6b5d7344d 100644 --- a/.github/workflows/craft.lock.yml +++ b/.github/workflows/craft.lock.yml @@ -57,9 +57,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" slash_command: ${{ needs.pre_activation.outputs.matched_command }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -89,6 +92,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/example-custom-error-patterns.lock.yml b/.github/workflows/example-custom-error-patterns.lock.yml index a6534df8420..5e6dfeba72f 100644 --- a/.github/workflows/example-custom-error-patterns.lock.yml +++ b/.github/workflows/example-custom-error-patterns.lock.yml @@ -49,8 +49,11 @@ jobs: permissions: contents: read outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -80,6 +83,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/firewall-escape.lock.yml b/.github/workflows/firewall-escape.lock.yml index add500221ee..77cc8a4fa42 100644 --- a/.github/workflows/firewall-escape.lock.yml +++ b/.github/workflows/firewall-escape.lock.yml @@ -59,8 +59,11 @@ jobs: permissions: contents: read outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -90,6 +93,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/grumpy-reviewer.lock.yml b/.github/workflows/grumpy-reviewer.lock.yml index 8ec41756272..f0eadfd1ec3 100644 --- a/.github/workflows/grumpy-reviewer.lock.yml +++ b/.github/workflows/grumpy-reviewer.lock.yml @@ -61,9 +61,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" slash_command: ${{ needs.pre_activation.outputs.matched_command }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -93,6 +96,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/issue-classifier.lock.yml b/.github/workflows/issue-classifier.lock.yml index 43bdbb9ce83..fe7f38a728a 100644 --- a/.github/workflows/issue-classifier.lock.yml +++ b/.github/workflows/issue-classifier.lock.yml @@ -54,8 +54,11 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -85,6 +88,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/mergefest.lock.yml b/.github/workflows/mergefest.lock.yml index e605f2c0f4a..0c6e539b9a2 100644 --- a/.github/workflows/mergefest.lock.yml +++ b/.github/workflows/mergefest.lock.yml @@ -56,9 +56,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" slash_command: ${{ needs.pre_activation.outputs.matched_command }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -88,6 +91,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/pdf-summary.lock.yml b/.github/workflows/pdf-summary.lock.yml index 84c0cf66beb..55fce34903d 100644 --- a/.github/workflows/pdf-summary.lock.yml +++ b/.github/workflows/pdf-summary.lock.yml @@ -76,9 +76,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" slash_command: ${{ needs.pre_activation.outputs.matched_command }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -108,6 +111,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/plan.lock.yml b/.github/workflows/plan.lock.yml index 6e2f0bfc8c0..f1f8db756d3 100644 --- a/.github/workflows/plan.lock.yml +++ b/.github/workflows/plan.lock.yml @@ -61,9 +61,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" slash_command: ${{ needs.pre_activation.outputs.matched_command }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -93,6 +96,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/poem-bot.lock.yml b/.github/workflows/poem-bot.lock.yml index bbf8bb6eedb..b59012e2d79 100644 --- a/.github/workflows/poem-bot.lock.yml +++ b/.github/workflows/poem-bot.lock.yml @@ -65,9 +65,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" slash_command: ${{ needs.pre_activation.outputs.matched_command }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -97,6 +100,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/pr-nitpick-reviewer.lock.yml b/.github/workflows/pr-nitpick-reviewer.lock.yml index 5937a32f618..c6aafaab747 100644 --- a/.github/workflows/pr-nitpick-reviewer.lock.yml +++ b/.github/workflows/pr-nitpick-reviewer.lock.yml @@ -86,9 +86,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" slash_command: ${{ needs.pre_activation.outputs.matched_command }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -118,6 +121,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/q.lock.yml b/.github/workflows/q.lock.yml index 5867549b23b..2df04e4b7a7 100644 --- a/.github/workflows/q.lock.yml +++ b/.github/workflows/q.lock.yml @@ -85,9 +85,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" slash_command: ${{ needs.pre_activation.outputs.matched_command }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -117,6 +120,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/refiner.lock.yml b/.github/workflows/refiner.lock.yml index 8030b00eeca..38deef092d6 100644 --- a/.github/workflows/refiner.lock.yml +++ b/.github/workflows/refiner.lock.yml @@ -61,8 +61,11 @@ jobs: permissions: contents: read outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -92,6 +95,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/scout.lock.yml b/.github/workflows/scout.lock.yml index 4d8a2c0cfb1..0adf3226ac0 100644 --- a/.github/workflows/scout.lock.yml +++ b/.github/workflows/scout.lock.yml @@ -101,9 +101,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" slash_command: ${{ needs.pre_activation.outputs.matched_command }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -133,6 +136,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/security-compliance.lock.yml b/.github/workflows/security-compliance.lock.yml index 2039c1a9bc8..4c8b18651ad 100644 --- a/.github/workflows/security-compliance.lock.yml +++ b/.github/workflows/security-compliance.lock.yml @@ -58,8 +58,11 @@ jobs: permissions: contents: read outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -89,6 +92,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/security-review.lock.yml b/.github/workflows/security-review.lock.yml index 7c933f56c93..d3f8131029d 100644 --- a/.github/workflows/security-review.lock.yml +++ b/.github/workflows/security-review.lock.yml @@ -61,9 +61,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" slash_command: ${{ needs.pre_activation.outputs.matched_command }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -93,6 +96,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/smoke-claude.lock.yml b/.github/workflows/smoke-claude.lock.yml index 2380aaae94a..673c4121d8e 100644 --- a/.github/workflows/smoke-claude.lock.yml +++ b/.github/workflows/smoke-claude.lock.yml @@ -67,9 +67,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: ${{ steps.add-comment.outputs.comment-id }} comment_repo: ${{ steps.add-comment.outputs.comment-repo }} comment_url: ${{ steps.add-comment.outputs.comment-url }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -99,6 +102,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Add comment with workflow run link id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) diff --git a/.github/workflows/smoke-codex.lock.yml b/.github/workflows/smoke-codex.lock.yml index 6a47688ebc6..7ec15f2e509 100644 --- a/.github/workflows/smoke-codex.lock.yml +++ b/.github/workflows/smoke-codex.lock.yml @@ -62,9 +62,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: ${{ steps.add-comment.outputs.comment-id }} comment_repo: ${{ steps.add-comment.outputs.comment-repo }} comment_url: ${{ steps.add-comment.outputs.comment-url }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -94,6 +97,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Add comment with workflow run link id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) diff --git a/.github/workflows/smoke-copilot-sdk.lock.yml b/.github/workflows/smoke-copilot-sdk.lock.yml index 0593dd09a4f..c009930e873 100644 --- a/.github/workflows/smoke-copilot-sdk.lock.yml +++ b/.github/workflows/smoke-copilot-sdk.lock.yml @@ -60,9 +60,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: ${{ steps.add-comment.outputs.comment-id }} comment_repo: ${{ steps.add-comment.outputs.comment-repo }} comment_url: ${{ steps.add-comment.outputs.comment-url }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -92,6 +95,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Add comment with workflow run link id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) diff --git a/.github/workflows/smoke-copilot.lock.yml b/.github/workflows/smoke-copilot.lock.yml index b1e61b404f1..3dd98f46888 100644 --- a/.github/workflows/smoke-copilot.lock.yml +++ b/.github/workflows/smoke-copilot.lock.yml @@ -63,9 +63,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: ${{ steps.add-comment.outputs.comment-id }} comment_repo: ${{ steps.add-comment.outputs.comment-repo }} comment_url: ${{ steps.add-comment.outputs.comment-url }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -95,6 +98,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Add comment with workflow run link id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) diff --git a/.github/workflows/smoke-opencode.lock.yml b/.github/workflows/smoke-opencode.lock.yml index 0d8db23b674..288ef0375e6 100644 --- a/.github/workflows/smoke-opencode.lock.yml +++ b/.github/workflows/smoke-opencode.lock.yml @@ -63,9 +63,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: ${{ steps.add-comment.outputs.comment-id }} comment_repo: ${{ steps.add-comment.outputs.comment-repo }} comment_url: ${{ steps.add-comment.outputs.comment-url }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -95,6 +98,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Add comment with workflow run link id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) diff --git a/.github/workflows/smoke-project.lock.yml b/.github/workflows/smoke-project.lock.yml index 3fb0a66b621..4c183bfad3f 100644 --- a/.github/workflows/smoke-project.lock.yml +++ b/.github/workflows/smoke-project.lock.yml @@ -55,9 +55,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: ${{ steps.add-comment.outputs.comment-id }} comment_repo: ${{ steps.add-comment.outputs.comment-repo }} comment_url: ${{ steps.add-comment.outputs.comment-url }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -87,6 +90,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Add comment with workflow run link id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) diff --git a/.github/workflows/smoke-temporary-id.lock.yml b/.github/workflows/smoke-temporary-id.lock.yml index e747365230b..d6de5e16862 100644 --- a/.github/workflows/smoke-temporary-id.lock.yml +++ b/.github/workflows/smoke-temporary-id.lock.yml @@ -55,9 +55,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: ${{ steps.add-comment.outputs.comment-id }} comment_repo: ${{ steps.add-comment.outputs.comment-repo }} comment_url: ${{ steps.add-comment.outputs.comment-url }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -87,6 +90,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Add comment with workflow run link id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) diff --git a/.github/workflows/smoke-test-tools.lock.yml b/.github/workflows/smoke-test-tools.lock.yml index 1fbfbc58d70..7aad2e467b6 100644 --- a/.github/workflows/smoke-test-tools.lock.yml +++ b/.github/workflows/smoke-test-tools.lock.yml @@ -55,8 +55,11 @@ jobs: permissions: contents: read outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -86,6 +89,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/tidy.lock.yml b/.github/workflows/tidy.lock.yml index 2ba3ba24f28..38ed526962c 100644 --- a/.github/workflows/tidy.lock.yml +++ b/.github/workflows/tidy.lock.yml @@ -69,9 +69,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" slash_command: ${{ needs.pre_activation.outputs.matched_command }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -101,6 +104,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/unbloat-docs.lock.yml b/.github/workflows/unbloat-docs.lock.yml index 88874f11f3b..b5b4f89ffa4 100644 --- a/.github/workflows/unbloat-docs.lock.yml +++ b/.github/workflows/unbloat-docs.lock.yml @@ -62,9 +62,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" slash_command: ${{ needs.pre_activation.outputs.matched_command }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -94,6 +97,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Create prompt with built-in context env: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt diff --git a/.github/workflows/workflow-generator.lock.yml b/.github/workflows/workflow-generator.lock.yml index 130377b4d4f..e8b8f470aa9 100644 --- a/.github/workflows/workflow-generator.lock.yml +++ b/.github/workflows/workflow-generator.lock.yml @@ -54,9 +54,12 @@ jobs: issues: write pull-requests: write outputs: + body: ${{ steps.sanitized.outputs.body }} comment_id: "" comment_repo: "" issue_locked: ${{ steps.lock-issue.outputs.locked }} + text: ${{ steps.sanitized.outputs.text }} + title: ${{ steps.sanitized.outputs.title }} steps: - name: Checkout actions folder uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -86,6 +89,15 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); + - name: Compute current body text + id: sanitized + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); + await main(); - name: Lock issue for agent workflow id: lock-issue if: (github.event_name == 'issues') || (github.event_name == 'issue_comment') diff --git a/pkg/workflow/compiler_activation_jobs.go b/pkg/workflow/compiler_activation_jobs.go index 2be0829bb34..05bc11ca134 100644 --- a/pkg/workflow/compiler_activation_jobs.go +++ b/pkg/workflow/compiler_activation_jobs.go @@ -479,10 +479,9 @@ func (c *Compiler) buildActivationJob(data *WorkflowData, preActivationJobCreate // This step computes sanitized versions of the triggering content (issue/PR/comment text, title, body) // and makes them available as step outputs. // - // IMPORTANT: These outputs are referenced as steps.sanitized.outputs.{text|title|body} in the activation job. - // The compiler automatically transforms markdown expressions like needs.activation.outputs.text to - // steps.sanitized.outputs.text because a job cannot reference its own needs.* outputs in GitHub Actions. - // See pkg/workflow/expression_extraction.go::transformActivationOutputs() for the transformation logic. + // IMPORTANT: These outputs are referenced as steps.sanitized.outputs.{text|title|body} in workflow markdown. + // Users should use ${{ steps.sanitized.outputs.text }} directly in their workflows. + // The outputs are also exposed as needs.activation.outputs.* for downstream jobs. if data.NeedsTextOutput { steps = append(steps, " - name: Compute current body text\n") steps = append(steps, " id: sanitized\n") @@ -493,7 +492,7 @@ func (c *Compiler) buildActivationJob(data *WorkflowData, preActivationJobCreate // Set up outputs - includes text, title, and body // These are exposed as needs.activation.outputs.* for downstream jobs - // but within the activation job itself, they must be referenced as steps.sanitized.outputs.* + // and as steps.sanitized.outputs.* within the activation job (where prompts are rendered) outputs["text"] = "${{ steps.sanitized.outputs.text }}" outputs["title"] = "${{ steps.sanitized.outputs.title }}" outputs["body"] = "${{ steps.sanitized.outputs.body }}" diff --git a/pkg/workflow/compiler_benchmark_test.go b/pkg/workflow/compiler_benchmark_test.go index d16ca7bf8b7..9ad34bbd39b 100644 --- a/pkg/workflow/compiler_benchmark_test.go +++ b/pkg/workflow/compiler_benchmark_test.go @@ -39,7 +39,7 @@ timeout-minutes: 10 Analyze the issue and provide helpful feedback. -Issue details: ${{ needs.activation.outputs.text }} +Issue details: ${{ steps.sanitized.outputs.text }} ` testFile := filepath.Join(tmpDir, "test-workflow.md") diff --git a/pkg/workflow/compiler_orchestrator_test.go b/pkg/workflow/compiler_orchestrator_test.go index 584c445c440..7bd5fa0c536 100644 --- a/pkg/workflow/compiler_orchestrator_test.go +++ b/pkg/workflow/compiler_orchestrator_test.go @@ -463,32 +463,32 @@ func TestDetectTextOutputUsageInOrchestrator(t *testing.T) { }, { name: "with text output usage", - markdown: "# Workflow\n\nUse ${{ needs.activation.outputs.text }} here.", + markdown: "# Workflow\n\nUse ${{ steps.sanitized.outputs.text }} here.", expectedOutput: true, }, { name: "text output in middle", - markdown: "# Start\n\nContent\n${{ needs.activation.outputs.text }}\n\nMore content", + markdown: "# Start\n\nContent\n${{ steps.sanitized.outputs.text }}\n\nMore content", expectedOutput: true, }, { name: "multiple text output references", - markdown: "${{ needs.activation.outputs.text }}\nFirst\n${{ needs.activation.outputs.text }}\nSecond", + markdown: "${{ steps.sanitized.outputs.text }}\nFirst\n${{ steps.sanitized.outputs.text }}\nSecond", expectedOutput: true, }, { name: "with title output usage", - markdown: "# Workflow\n\nUse ${{ needs.activation.outputs.title }} here.", + markdown: "# Workflow\n\nUse ${{ steps.sanitized.outputs.title }} here.", expectedOutput: true, }, { name: "with body output usage", - markdown: "# Workflow\n\nUse ${{ needs.activation.outputs.body }} here.", + markdown: "# Workflow\n\nUse ${{ steps.sanitized.outputs.body }} here.", expectedOutput: true, }, { name: "with mixed text, title, body usage", - markdown: "# Workflow\n\nTitle: ${{ needs.activation.outputs.title }}\nBody: ${{ needs.activation.outputs.body }}\nFull: ${{ needs.activation.outputs.text }}", + markdown: "# Workflow\n\nTitle: ${{ steps.sanitized.outputs.title }}\nBody: ${{ steps.sanitized.outputs.body }}\nFull: ${{ steps.sanitized.outputs.text }}", expectedOutput: true, }, } diff --git a/pkg/workflow/compiler_orchestrator_tools.go b/pkg/workflow/compiler_orchestrator_tools.go index 51bb8eef504..08a648b3fef 100644 --- a/pkg/workflow/compiler_orchestrator_tools.go +++ b/pkg/workflow/compiler_orchestrator_tools.go @@ -9,6 +9,7 @@ import ( "github.com/github/gh-aw/pkg/console" "github.com/github/gh-aw/pkg/logger" "github.com/github/gh-aw/pkg/parser" + "github.com/goccy/go-yaml" ) var orchestratorToolsLog = logger.New("workflow:compiler_orchestrator_tools") @@ -301,8 +302,15 @@ func (c *Compiler) processToolsAndMarkdown(result *parser.FrontmatterResult, cle log.Printf("Extracted workflow name: '%s'", workflowName) - // Check if the markdown content uses the text output - needsTextOutput := c.detectTextOutputUsage(markdownContent) + // Check if the markdown content uses the text output OR if the workflow is triggered by + // events that have content (issues, discussions, PRs, comments). The sanitized step should + // be added in either case to make text/title/body outputs available. + explicitUsage := c.detectTextOutputUsage(markdownContent) + hasContext := c.hasContentContext(result.Frontmatter) + needsTextOutput := explicitUsage || hasContext + + orchestratorToolsLog.Printf("Text output needed: explicit=%v, context=%v, final=%v", + explicitUsage, hasContext, needsTextOutput) // Extract and validate tracker-id trackerID, err := c.extractTrackerID(result.Frontmatter) @@ -340,16 +348,75 @@ func (c *Compiler) processToolsAndMarkdown(result *parser.FrontmatterResult, cle }, nil } -// detectTextOutputUsage checks if the markdown content uses ${{ needs.activation.outputs.text }}, -// ${{ needs.activation.outputs.title }}, or ${{ needs.activation.outputs.body }} +// detectTextOutputUsage checks if the markdown content uses ${{ steps.sanitized.outputs.text }}, +// ${{ steps.sanitized.outputs.title }}, or ${{ steps.sanitized.outputs.body }} func (c *Compiler) detectTextOutputUsage(markdownContent string) bool { // Check for any of the text-related output expressions - hasTextUsage := strings.Contains(markdownContent, "${{ needs.activation.outputs.text }}") - hasTitleUsage := strings.Contains(markdownContent, "${{ needs.activation.outputs.title }}") - hasBodyUsage := strings.Contains(markdownContent, "${{ needs.activation.outputs.body }}") + hasTextUsage := strings.Contains(markdownContent, "${{ steps.sanitized.outputs.text }}") + hasTitleUsage := strings.Contains(markdownContent, "${{ steps.sanitized.outputs.title }}") + hasBodyUsage := strings.Contains(markdownContent, "${{ steps.sanitized.outputs.body }}") hasUsage := hasTextUsage || hasTitleUsage || hasBodyUsage - detectionLog.Printf("Detected usage of activation outputs - text: %v, title: %v, body: %v, any: %v", + detectionLog.Printf("Detected usage of sanitized outputs - text: %v, title: %v, body: %v, any: %v", hasTextUsage, hasTitleUsage, hasBodyUsage, hasUsage) return hasUsage } + +// hasContentContext checks if the workflow is triggered by events that have text content +// (issues, discussions, pull requests, or comments). These events can provide sanitized +// text/title/body outputs via the sanitized step, even if not explicitly referenced. +func (c *Compiler) hasContentContext(frontmatter map[string]any) bool { + // Check if "on" field exists + onField, exists := frontmatter["on"] + if !exists || onField == nil { + return false + } + + // Convert the "on" field to YAML string for parsing + onYAML, err := yaml.Marshal(onField) + if err != nil { + orchestratorToolsLog.Printf("Failed to marshal 'on' field: %v", err) + return false + } + + onStr := string(onYAML) + + // Check for content-related event types that provide text/title/body + // These are the same events supported by compute_text.cjs + contentEvents := []string{ + "issues:", + "pull_request:", + "pull_request_target:", + "issue_comment:", + "pull_request_review_comment:", + "pull_request_review:", + "discussion:", + "discussion_comment:", + } + + for _, event := range contentEvents { + if strings.Contains(onStr, event) { + orchestratorToolsLog.Printf("Detected content context: workflow triggered by %s", strings.TrimSuffix(event, ":")) + return true + } + } + + // Check for slash_command trigger (works with comment events that have content) + if strings.Contains(onStr, "slash_command:") { + orchestratorToolsLog.Printf("Detected content context: workflow triggered by slash_command") + return true + } + + // Check for labeled activity type on issues, pull_request, or discussion + // These events provide text content when labeled/unlabeled + if strings.Contains(onStr, "labeled") { + // Ensure it's in the context of an issue, PR, or discussion event + if strings.Contains(onStr, "issues:") || strings.Contains(onStr, "pull_request:") || strings.Contains(onStr, "discussion:") { + orchestratorToolsLog.Printf("Detected content context: workflow triggered by labeled activity type") + return true + } + } + + orchestratorToolsLog.Printf("No content context detected in trigger events") + return false +} diff --git a/pkg/workflow/compiler_orchestrator_tools_test.go b/pkg/workflow/compiler_orchestrator_tools_test.go index 692ab045f44..6a32c8fe92e 100644 --- a/pkg/workflow/compiler_orchestrator_tools_test.go +++ b/pkg/workflow/compiler_orchestrator_tools_test.go @@ -508,7 +508,7 @@ func TestProcessToolsAndMarkdown_TextOutputDetection(t *testing.T) { }, { name: "with text output", - markdown: "# Workflow\n\nUse ${{ needs.activation.outputs.text }} here", + markdown: "# Workflow\n\nUse ${{ steps.sanitized.outputs.text }} here", expectUsage: true, }, } diff --git a/pkg/workflow/compiler_orchestrator_workflow_test.go b/pkg/workflow/compiler_orchestrator_workflow_test.go index 3724f5446f3..866a8a70289 100644 --- a/pkg/workflow/compiler_orchestrator_workflow_test.go +++ b/pkg/workflow/compiler_orchestrator_workflow_test.go @@ -1022,7 +1022,7 @@ timeout-minutes: 45 # Phase Test Workflow -Test content with ${{ needs.activation.outputs.text }} usage. +Test content with ${{ steps.sanitized.outputs.text }} usage. ` testFile := filepath.Join(tmpDir, "phase-flow.md") diff --git a/pkg/workflow/compiler_performance_benchmark_test.go b/pkg/workflow/compiler_performance_benchmark_test.go index 671f678f449..0348bf4a095 100644 --- a/pkg/workflow/compiler_performance_benchmark_test.go +++ b/pkg/workflow/compiler_performance_benchmark_test.go @@ -32,7 +32,7 @@ timeout-minutes: 5 # Simple Issue Handler -Analyze the issue: ${{ needs.activation.outputs.text }} +Analyze the issue: ${{ steps.sanitized.outputs.text }} ` testFile := filepath.Join(tmpDir, "simple.md") diff --git a/pkg/workflow/compute_text_lazy_test.go b/pkg/workflow/compute_text_lazy_test.go index 93da1f6e11e..fe80f444aef 100644 --- a/pkg/workflow/compute_text_lazy_test.go +++ b/pkg/workflow/compute_text_lazy_test.go @@ -42,7 +42,7 @@ tools: # Test Workflow With Text Output -This workflow uses the text output: "${{ needs.activation.outputs.text }}" +This workflow uses the text output: "${{ steps.sanitized.outputs.text }}" Please analyze this issue and provide a helpful response.` @@ -162,7 +162,7 @@ func TestDetectTextOutputUsage(t *testing.T) { }{ { name: "with_text_usage", - content: "Analyze this: \"${{ needs.activation.outputs.text }}\"", + content: "Analyze this: \"${{ steps.sanitized.outputs.text }}\"", expectedUsage: true, }, { @@ -182,7 +182,17 @@ func TestDetectTextOutputUsage(t *testing.T) { }, { name: "with_multiple_usages", - content: "First: \"${{ needs.activation.outputs.text }}\" and second: \"${{ needs.activation.outputs.text }}\"", + content: "First: \"${{ steps.sanitized.outputs.text }}\" and second: \"${{ steps.sanitized.outputs.text }}\"", + expectedUsage: true, + }, + { + name: "with_title_usage", + content: "Title: \"${{ steps.sanitized.outputs.title }}\"", + expectedUsage: true, + }, + { + name: "with_body_usage", + content: "Body: \"${{ steps.sanitized.outputs.body }}\"", expectedUsage: true, }, } @@ -196,3 +206,422 @@ func TestDetectTextOutputUsage(t *testing.T) { }) } } + +func TestHasContentContext(t *testing.T) { + compiler := NewCompiler() + + tests := []struct { + name string + frontmatter map[string]any + expectedContext bool + }{ + { + name: "issues_event", + frontmatter: map[string]any{ + "on": map[string]any{ + "issues": map[string]any{ + "types": []string{"opened"}, + }, + }, + }, + expectedContext: true, + }, + { + name: "pull_request_event", + frontmatter: map[string]any{ + "on": map[string]any{ + "pull_request": map[string]any{ + "types": []string{"opened"}, + }, + }, + }, + expectedContext: true, + }, + { + name: "pull_request_target_event", + frontmatter: map[string]any{ + "on": map[string]any{ + "pull_request_target": map[string]any{ + "types": []string{"opened"}, + }, + }, + }, + expectedContext: true, + }, + { + name: "issue_comment_event", + frontmatter: map[string]any{ + "on": map[string]any{ + "issue_comment": map[string]any{ + "types": []string{"created"}, + }, + }, + }, + expectedContext: true, + }, + { + name: "pull_request_review_comment_event", + frontmatter: map[string]any{ + "on": map[string]any{ + "pull_request_review_comment": map[string]any{ + "types": []string{"created"}, + }, + }, + }, + expectedContext: true, + }, + { + name: "pull_request_review_event", + frontmatter: map[string]any{ + "on": map[string]any{ + "pull_request_review": map[string]any{ + "types": []string{"submitted"}, + }, + }, + }, + expectedContext: true, + }, + { + name: "discussion_event", + frontmatter: map[string]any{ + "on": map[string]any{ + "discussion": map[string]any{ + "types": []string{"created"}, + }, + }, + }, + expectedContext: true, + }, + { + name: "discussion_comment_event", + frontmatter: map[string]any{ + "on": map[string]any{ + "discussion_comment": map[string]any{ + "types": []string{"created"}, + }, + }, + }, + expectedContext: true, + }, + { + name: "schedule_event_no_context", + frontmatter: map[string]any{ + "on": map[string]any{ + "schedule": []map[string]string{ + {"cron": "0 0 * * *"}, + }, + }, + }, + expectedContext: false, + }, + { + name: "push_event_no_context", + frontmatter: map[string]any{ + "on": map[string]any{ + "push": map[string]any{ + "branches": []string{"main"}, + }, + }, + }, + expectedContext: false, + }, + { + name: "workflow_dispatch_no_context", + frontmatter: map[string]any{ + "on": "workflow_dispatch", + }, + expectedContext: false, + }, + { + name: "multiple_events_with_context", + frontmatter: map[string]any{ + "on": map[string]any{ + "issues": map[string]any{ + "types": []string{"opened"}, + }, + "workflow_dispatch": map[string]any{}, + }, + }, + expectedContext: true, + }, + { + name: "multiple_events_no_context", + frontmatter: map[string]any{ + "on": map[string]any{ + "push": map[string]any{ + "branches": []string{"main"}, + }, + "workflow_dispatch": map[string]any{}, + }, + }, + expectedContext: false, + }, + { + name: "no_on_field", + frontmatter: map[string]any{}, + expectedContext: false, + }, + { + name: "slash_command_trigger", + frontmatter: map[string]any{ + "on": map[string]any{ + "slash_command": map[string]any{ + "name": "test", + "events": []string{"issues", "issue_comment"}, + }, + }, + }, + expectedContext: true, + }, + { + name: "labeled_on_issues", + frontmatter: map[string]any{ + "on": map[string]any{ + "issues": map[string]any{ + "types": []string{"labeled", "unlabeled"}, + }, + }, + }, + expectedContext: true, + }, + { + name: "labeled_on_pull_request", + frontmatter: map[string]any{ + "on": map[string]any{ + "pull_request": map[string]any{ + "types": []string{"opened", "labeled"}, + }, + }, + }, + expectedContext: true, + }, + { + name: "labeled_on_discussion", + frontmatter: map[string]any{ + "on": map[string]any{ + "discussion": map[string]any{ + "types": []string{"labeled"}, + }, + }, + }, + expectedContext: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := compiler.hasContentContext(tt.frontmatter) + if result != tt.expectedContext { + t.Errorf("hasContentContext() = %v, expected %v", result, tt.expectedContext) + } + }) + } +} + +func TestComputeTextContextBasedInsertion(t *testing.T) { + // Create a temporary directory for the test + tempDir, err := os.MkdirTemp("", "compute-text-context-test") + if err != nil { + t.Fatalf("Failed to create temp dir: %v", err) + } + defer os.RemoveAll(tempDir) + + // Create a .git directory to simulate a git repository + gitDir := filepath.Join(tempDir, ".git") + if err := os.MkdirAll(gitDir, 0755); err != nil { + t.Fatalf("Failed to create .git dir: %v", err) + } + + tests := []struct { + name string + workflow string + expectedSanitized bool + expectedTextOutput bool + }{ + { + name: "issue_trigger_without_explicit_usage", + workflow: `--- +on: + issues: + types: [opened] +permissions: + issues: write +strict: false +features: + dangerous-permissions-write: true +tools: + github: + toolsets: [issues] +--- + +# Test Issue Workflow + +Analyze the issue and provide a response. + +This workflow does NOT explicitly use text output but should get sanitized step.`, + expectedSanitized: true, + expectedTextOutput: true, + }, + { + name: "pr_trigger_without_explicit_usage", + workflow: `--- +on: + pull_request: + types: [opened] +permissions: + pull-requests: write +strict: false +features: + dangerous-permissions-write: true +tools: + github: + toolsets: [pull_requests] +--- + +# Test PR Workflow + +Review the pull request. + +This workflow does NOT explicitly use text output but should get sanitized step.`, + expectedSanitized: true, + expectedTextOutput: true, + }, + { + name: "discussion_trigger_without_explicit_usage", + workflow: `--- +on: + discussion: + types: [created] +permissions: + discussions: write +strict: false +features: + dangerous-permissions-write: true +tools: + github: + toolsets: [discussions] +--- + +# Test Discussion Workflow + +Respond to the discussion. + +This workflow does NOT explicitly use text output but should get sanitized step.`, + expectedSanitized: true, + expectedTextOutput: true, + }, + { + name: "issue_comment_trigger_without_explicit_usage", + workflow: `--- +on: + issue_comment: + types: [created] +permissions: + issues: write +strict: false +features: + dangerous-permissions-write: true +tools: + github: + toolsets: [issues] +--- + +# Test Comment Workflow + +Respond to the comment. + +This workflow does NOT explicitly use text output but should get sanitized step.`, + expectedSanitized: true, + expectedTextOutput: true, + }, + { + name: "schedule_trigger_without_explicit_usage", + workflow: `--- +on: + schedule: + - cron: "0 9 * * 1" +permissions: + issues: write +strict: false +features: + dangerous-permissions-write: true +tools: + github: + toolsets: [issues] +--- + +# Test Schedule Workflow + +Create a report. + +This workflow does NOT use text output and has no content context, so NO sanitized step.`, + expectedSanitized: false, + expectedTextOutput: false, + }, + { + name: "issue_trigger_with_explicit_usage", + workflow: `--- +on: + issues: + types: [opened] +permissions: + issues: write +strict: false +features: + dangerous-permissions-write: true +tools: + github: + toolsets: [issues] +--- + +# Test Issue Workflow With Explicit Usage + +Analyze this: "${{ steps.sanitized.outputs.text }}" + +This workflow explicitly uses text output AND has content context.`, + expectedSanitized: true, + expectedTextOutput: true, + }, + } + + compiler := NewCompiler() + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + workflowPath := filepath.Join(tempDir, tt.name+".md") + if err := os.WriteFile(workflowPath, []byte(tt.workflow), 0644); err != nil { + t.Fatalf("Failed to write workflow: %v", err) + } + + err := compiler.CompileWorkflow(workflowPath) + if err != nil { + t.Fatalf("Failed to compile workflow: %v", err) + } + + // Check the compiled YAML + lockPath := stringutil.MarkdownToLockFile(workflowPath) + lockContent, err := os.ReadFile(lockPath) + if err != nil { + t.Fatalf("Failed to read compiled workflow: %v", err) + } + + lockStr := string(lockContent) + + // Check for sanitized step + hasSanitizedStep := strings.Contains(lockStr, "id: sanitized") + if hasSanitizedStep != tt.expectedSanitized { + t.Errorf("Expected sanitized step: %v, got: %v\nWorkflow:\n%s", + tt.expectedSanitized, hasSanitizedStep, lockStr) + } + + // Check for text output + hasTextOutput := strings.Contains(lockStr, "text: ${{ steps.sanitized.outputs.text }}") + if hasTextOutput != tt.expectedTextOutput { + t.Errorf("Expected text output: %v, got: %v", tt.expectedTextOutput, hasTextOutput) + } + + // Cleanup for next test + os.RemoveAll(filepath.Join(tempDir, ".github")) + }) + } +} diff --git a/pkg/workflow/custom_job_condition_test.go b/pkg/workflow/custom_job_condition_test.go index c0ef60051e0..ebae3f2e3d4 100644 --- a/pkg/workflow/custom_job_condition_test.go +++ b/pkg/workflow/custom_job_condition_test.go @@ -45,7 +45,7 @@ func TestReferencesCustomJobOutputs(t *testing.T) { }, { name: "references standard job not custom", - condition: "needs.activation.outputs.text != ''", + condition: "steps.sanitized.outputs.text != ''", customJobs: map[string]any{"ast_grep": nil}, expected: false, }, diff --git a/pkg/workflow/expression_extraction.go b/pkg/workflow/expression_extraction.go index f97e5212e02..c902ca0efff 100644 --- a/pkg/workflow/expression_extraction.go +++ b/pkg/workflow/expression_extraction.go @@ -62,11 +62,10 @@ func (e *ExpressionExtractor) ExtractExpressions(markdown string) ([]*Expression // Extract the content (without ${{ }}) content := strings.TrimSpace(match[1]) - // Apply activation output transformation (codemod) - // Replace needs.activation.outputs.{text|title|body} with steps.sanitized.outputs.{text|title|body} - // This is needed because the prompt is generated IN the activation job, so it can't reference - // needs.activation.outputs.* (a job can't reference its own needs outputs). - // Instead, it should reference the sanitized step outputs directly. + // Apply activation output transformation for backward compatibility + // This transforms needs.activation.outputs.{text|title|body} to steps.sanitized.outputs.{text|title|body} + // Users should now use steps.sanitized.outputs.* directly, but we keep this transformation + // for backward compatibility with existing workflows. transformedContent := transformActivationOutputs(content) if transformedContent != content { expressionExtractionLog.Printf("Transformed expression: %s -> %s", content, transformedContent) @@ -108,8 +107,9 @@ func (e *ExpressionExtractor) ExtractExpressions(markdown string) ([]*Expression } // transformActivationOutputs transforms needs.activation.outputs.* expressions to steps.sanitized.outputs.* -// This is a codemod that automatically fixes expressions that reference activation job outputs, -// which are not accessible within the activation job itself (a job can't reference its own needs outputs). +// for backward compatibility with existing workflows. +// +// NEW WORKFLOWS should use steps.sanitized.outputs.* directly in their markdown. // // The function transforms these specific outputs: // diff --git a/pkg/workflow/expression_parser_fuzz_test.go b/pkg/workflow/expression_parser_fuzz_test.go index e9a9447fca3..bf2873e8a0e 100644 --- a/pkg/workflow/expression_parser_fuzz_test.go +++ b/pkg/workflow/expression_parser_fuzz_test.go @@ -25,7 +25,7 @@ func FuzzExpressionParser(f *testing.F) { f.Add("Actor: ${{ github.actor }}") f.Add("Issue number: ${{ github.event.issue.number }}") f.Add("PR number: ${{ github.event.pull_request.number }}") - f.Add("Task output: ${{ needs.activation.outputs.text }}") + f.Add("Task output: ${{ steps.sanitized.outputs.text }}") f.Add("Step output: ${{ steps.my-step.outputs.result }}") f.Add("User input: ${{ github.event.inputs.name }}") f.Add("Env variable: ${{ env.MY_VAR }}") diff --git a/pkg/workflow/expression_safety_test.go b/pkg/workflow/expression_safety_test.go index d8000a30f43..83f7ed18dc7 100644 --- a/pkg/workflow/expression_safety_test.go +++ b/pkg/workflow/expression_safety_test.go @@ -47,7 +47,7 @@ func TestValidateExpressionSafety(t *testing.T) { }, { name: "allowed_needs_task_outputs_text", - content: "Task output: ${{ needs.activation.outputs.text }}", + content: "Task output: ${{ steps.sanitized.outputs.text }}", expectError: false, }, { @@ -102,7 +102,7 @@ func TestValidateExpressionSafety(t *testing.T) { }, { name: "multiple_allowed_expressions", - content: "Workflow: ${{ github.workflow }}, Repository: ${{ github.repository }}, Output: ${{ needs.activation.outputs.text }}", + content: "Workflow: ${{ github.workflow }}, Repository: ${{ github.repository }}, Output: ${{ steps.sanitized.outputs.text }}", expectError: false, }, { diff --git a/pkg/workflow/expressions_benchmark_test.go b/pkg/workflow/expressions_benchmark_test.go index 54eef501da7..be991dcb71f 100644 --- a/pkg/workflow/expressions_benchmark_test.go +++ b/pkg/workflow/expressions_benchmark_test.go @@ -44,7 +44,7 @@ func BenchmarkValidateExpression_Complex(b *testing.B) { // BenchmarkValidateExpression_NeedsOutputs benchmarks needs.*.outputs.* validation func BenchmarkValidateExpression_NeedsOutputs(b *testing.B) { - expression := "needs.activation.outputs.text" + expression := "steps.sanitized.outputs.text" unauthorizedExprs := []string{} b.ResetTimer() @@ -84,7 +84,7 @@ func BenchmarkValidateExpressionSafety(b *testing.B) { Analyze issue #${{ github.event.issue.number }} in repository ${{ github.repository }}. -The issue content is: "${{ needs.activation.outputs.text }}" +The issue content is: "${{ steps.sanitized.outputs.text }}" The issue was created by ${{ github.actor }} with title: "${{ github.event.issue.title }}" @@ -120,7 +120,7 @@ func BenchmarkValidateExpressionSafety_Complex(b *testing.B) { - Job: ${{ github.job }} ## Previous Step Outputs -- Activation: ${{ needs.activation.outputs.text }} +- Activation: ${{ steps.sanitized.outputs.text }} - Analysis: ${{ steps.analyze.outputs.result }} - Summary: ${{ steps.summarize.outputs.content }} diff --git a/pkg/workflow/security_regression_test.go b/pkg/workflow/security_regression_test.go index 83d60d2db40..caac5a80c51 100644 --- a/pkg/workflow/security_regression_test.go +++ b/pkg/workflow/security_regression_test.go @@ -70,7 +70,7 @@ func TestSecurityTemplateInjectionPrevention(t *testing.T) { }, { name: "allowed_needs_output", - content: "${{ needs.activation.outputs.text }}", + content: "${{ steps.sanitized.outputs.text }}", shouldBlock: false, description: "Needs outputs should be allowed", }, diff --git a/pkg/workflow/task_and_reaction_permissions_test.go b/pkg/workflow/task_and_reaction_permissions_test.go index 28e3b4c5821..0bbcb460252 100644 --- a/pkg/workflow/task_and_reaction_permissions_test.go +++ b/pkg/workflow/task_and_reaction_permissions_test.go @@ -36,7 +36,7 @@ strict: false This workflow should generate activation job with reaction permissions. -The activation job references text output: "${{ needs.activation.outputs.text }}" +The activation job references text output: "${{ steps.sanitized.outputs.text }}" ` testFile := filepath.Join(tmpDir, "test-permissions.md") diff --git a/pkg/workflow/template_expression_integration_test.go b/pkg/workflow/template_expression_integration_test.go index 36c39c62de4..34892c00a5a 100644 --- a/pkg/workflow/template_expression_integration_test.go +++ b/pkg/workflow/template_expression_integration_test.go @@ -56,10 +56,10 @@ You are analyzing PR #${{ github.event.pull_request.number }} in repository ${{ The PR was created by ${{ github.actor }}. {{/if}} -{{#if needs.activation.outputs.text}} +{{#if steps.sanitized.outputs.text}} ## Content -${{ needs.activation.outputs.text }} +${{ steps.sanitized.outputs.text }} {{/if}} ## Instructions @@ -110,7 +110,7 @@ ${{ needs.activation.outputs.text }} } // Verify that the main workflow content is loaded via runtime-import - // Template conditionals in the user's markdown (like needs.activation.outputs.text) + // Template conditionals in the user's markdown (like steps.sanitized.outputs.text) // are processed at runtime by the JavaScript runtime_import helper if !strings.Contains(compiledStr, "{{#runtime-import") { t.Error("Compiled workflow should contain runtime-import macro for main workflow content") diff --git a/pkg/workflow/template_expression_wrapping_test.go b/pkg/workflow/template_expression_wrapping_test.go index f1a501226fb..9f9ea753dd6 100644 --- a/pkg/workflow/template_expression_wrapping_test.go +++ b/pkg/workflow/template_expression_wrapping_test.go @@ -29,8 +29,8 @@ func TestWrapExpressionsInTemplateConditionals(t *testing.T) { }, { name: "needs. expression", - input: "{{#if needs.activation.outputs.text}}content{{/if}}", - expected: "{{#if ${{ needs.activation.outputs.text }} }}content{{/if}}", + input: "{{#if steps.sanitized.outputs.text}}content{{/if}}", + expected: "{{#if ${{ steps.sanitized.outputs.text }} }}content{{/if}}", }, { name: "steps. expression", diff --git a/pkg/workflow/template_fuzz_test.go b/pkg/workflow/template_fuzz_test.go index 76f53071bc8..09b2d95abb8 100644 --- a/pkg/workflow/template_fuzz_test.go +++ b/pkg/workflow/template_fuzz_test.go @@ -24,7 +24,7 @@ func FuzzWrapExpressionsInTemplateConditionals(f *testing.F) { f.Add("{{#if github.event.issue.number}}content{{/if}}") f.Add("{{#if github.actor}}content{{/if}}") f.Add("{{#if github.repository}}content{{/if}}") - f.Add("{{#if needs.activation.outputs.text}}content{{/if}}") + f.Add("{{#if steps.sanitized.outputs.text}}content{{/if}}") f.Add("{{#if steps.my-step.outputs.result}}content{{/if}}") f.Add("{{#if env.MY_VAR}}content{{/if}}")