Skip to content

Fix missing staged environment variable in create-discussion jobs#800

Merged
pelikhan merged 2 commits intomainfrom
copilot/fix-917865fc-f93f-4ef9-b5bd-83655d78094a
Sep 12, 2025
Merged

Fix missing staged environment variable in create-discussion jobs#800
pelikhan merged 2 commits intomainfrom
copilot/fix-917865fc-f93f-4ef9-b5bd-83655d78094a

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 12, 2025

This PR addresses the requirement to review all test agentic workflows in the repository and ensure that workflows marked with staged: true have the GITHUB_AW_SAFE_OUTPUTS_STAGED environment variable properly code generated in their lock files.

Analysis Results

After comprehensive investigation, a missing staged environment variable was found and fixed in create-discussion jobs.

Issue Identified:

While most safe output types correctly included the staged environment variable, create-discussion jobs were missing the GITHUB_AW_SAFE_OUTPUTS_STAGED environment variable in their job configuration.

Changes Made:

  1. Fixed Compiler Logic: Added missing staged environment variable logic to buildCreateOutputDiscussionJob function in pkg/workflow/compiler.go
  2. Consistent Pattern: Create-discussion jobs now match the pattern used by create-issue and create-pull-request jobs
  3. Recompiled Workflow: Updated test-safe-output-create-discussion.lock.yml to include the staged variable

Verification Results:

Before Fix:

  • Custom engine steps had GITHUB_AW_SAFE_OUTPUTS_STAGED: "true"
  • Create-discussion job was missing the environment variable ❌

After Fix:

  • Custom engine steps: GITHUB_AW_SAFE_OUTPUTS_STAGED: "true"
  • Create-discussion job: GITHUB_AW_SAFE_OUTPUTS_STAGED: "true"
  • JavaScript code properly checks this environment variable ✅

Validated Workflows:

  • test-safe-output-add-issue-comment.md ✅
  • test-safe-output-add-issue-label.md ✅
  • test-safe-output-create-code-scanning-alert.md ✅
  • test-safe-output-create-discussion.md ✅ (now fixed)
  • test-safe-output-create-issue.md ✅
  • test-safe-output-create-pull-request-review-comment.md ✅
  • test-safe-output-create-pull-request.md ✅
  • test-safe-output-missing-tool.md ✅
  • test-safe-output-push-to-pr-branch.md ✅
  • test-safe-output-update-issue.md ✅

The staging functionality now works correctly across all safe output types - workflows with staged: true in their frontmatter properly generate the environment variable in both custom engine steps and safe output processing jobs.


✨ 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 changed the title [WIP] Review all the test genic workflow in the repo and make sure that the ones that are stage have the stage environment variable properly code generated in the lock file Verify stage environment variable generation for agentic workflows Sep 12, 2025
Copilot AI requested a review from pelikhan September 12, 2025 16:52
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot double check create-discussion and make sure the staged environment variable is set on that step

- Fixed missing GITHUB_AW_SAFE_OUTPUTS_STAGED environment variable in buildCreateOutputDiscussionJob
- Ensures create-discussion jobs properly check for staged mode like other safe output types
- Recompiled test-safe-output-create-discussion workflow to include the staged variable

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 12, 2025

@copilot double check create-discussion and make sure the staged environment variable is set on that step

I've verified the create-discussion step and found that it was missing the staged environment variable. The issue has been fixed in commit ca0c328.

What was wrong:

  • Create-discussion jobs were missing the GITHUB_AW_SAFE_OUTPUTS_STAGED: "true" environment variable
  • While custom engine steps had it correctly set, the create-discussion job itself didn't receive it

What was fixed:

  • Added the staged environment variable logic to buildCreateOutputDiscussionJob in the compiler
  • Now matches the pattern used by create-issue and create-pull-request jobs
  • Recompiled the test workflow to include the staged variable

Verification:
The create-discussion workflow now correctly has the staged environment variable set at line 1128 of the lock file, allowing the JavaScript code to properly detect staged mode and show a preview instead of creating actual discussions.

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:

  • api.contoso.com
    • Triggering command: /tmp/go-build1755024240/b278/cli.test -test.testlogfile=/tmp/go-build1755024240/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)
    • Triggering command: /tmp/go-build3567036355/b278/cli.test -test.testlogfile=/tmp/go-build3567036355/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Verify stage environment variable generation for agentic workflows Fix missing staged environment variable in create-discussion jobs Sep 12, 2025
@pelikhan pelikhan marked this pull request as ready for review September 12, 2025 19:25
@pelikhan pelikhan merged commit ad6abdd into main Sep 12, 2025
@pelikhan pelikhan deleted the copilot/fix-917865fc-f93f-4ef9-b5bd-83655d78094a branch September 12, 2025 19:25
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