Repository navigation
Add job-level environment variables for safe outputs configuration only - #1061
Merged
Merged
Conversation
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Copilot
AI
changed the title
[WIP] Update the compiler to generate an "env" section at the job level for the "action" job with the environment variables for safe outputs (file location and config)
Add job-level environment variables for safe outputs in agent job
Sep 26, 2025
pelikhan
reviewed
Sep 27, 2025
Co-authored-by: pelikhan <[email protected]>
pelikhan
reviewed
Sep 27, 2025
pelikhan
reviewed
Sep 27, 2025
| } | ||
|
|
||
| // Add custom environment variables from safe-outputs.env | ||
| if len(data.SafeOutputs.Env) > 0 { |
Collaborator
There was a problem hiding this comment.
@copilot remove this code, safeoutputs.env do not belong here
Contributor
Author
There was a problem hiding this comment.
Removed the code that adds custom environment variables from safe-outputs.env to the job-level environment. These custom variables are still passed to individual safe output jobs where they're needed, but no longer appear at the agent job level. Updated tests accordingly. (e82abf4)
Co-authored-by: pelikhan <[email protected]>
Copilot
AI
changed the title
Add job-level environment variables for safe outputs in agent job
Add job-level environment variables for safe outputs in agent job (excluding GITHUB_AW_SAFE_OUTPUTS)
Sep 27, 2025
Co-authored-by: pelikhan <[email protected]>
Copilot
AI
changed the title
Add job-level environment variables for safe outputs in agent job (excluding GITHUB_AW_SAFE_OUTPUTS)
Add job-level environment variables for safe outputs configuration only
Sep 27, 2025
…ty and error handling - Simplified environment variable checks and JSON parsing in create_discussion.js and create_issue.js - Enhanced logging for better debugging and user feedback - Streamlined discussion and issue creation logic, ensuring consistent handling of labels and titles - Added comments to parent issues when creating related issues - Improved summary output for staged mode previews
pelikhan
marked this pull request as ready for review
September 27, 2025 00:40
pelikhan
deleted the
copilot/fix-358a918a-48c1-412a-b782-2f0599e27eab
branch
September 27, 2025 00:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements job-level environment variables for the "agent" job when safe outputs are configured, specifically limited to configuration variables needed at the job level.
Problem
Previously, safe output configuration variables like
GITHUB_AW_SAFE_OUTPUTS_CONFIGwere only available at the step level. Steps that needed to reference these variables had to use expressions like${{ env.GITHUB_AW_SAFE_OUTPUTS_CONFIG }}, but the variables weren't actually defined at the job level, causing potential issues with variable resolution.Solution
Key Changes
Enhanced Job Struct: Added
Env map[string]stringfield to the Job struct to support job-level environment variables.Updated YAML Rendering: Modified the
renderJob()function to render the job-levelenv:section with proper indentation and sorted keys for consistent output.Modified Main Job Builder: Updated
buildMainJob()function to automatically populate only essential configuration environment variables when safe outputs are configured:GITHUB_AW_SAFE_OUTPUTS_CONFIG: Contains the JSON configuration for safe outputs (properly quoted)GITHUB_AW_SAFE_OUTPUTS(remains available through step-level export)safe-outputs.env(passed to individual safe output jobs where needed)Lock File Management: Reverted automatically generated
.lock.ymlfiles to their original state to prevent unintended changes to existing workflows while preserving the new functionality for future workflows.Example Output
The agent job now includes only essential configuration environment variables:
Benefits
${{ env.GITHUB_AW_SAFE_OUTPUTS_CONFIG }}syntaxArchitecture Decisions
GITHUB_AW_SAFE_OUTPUTS: Excluded from job level as it's dynamically set by the "Setup agent output" step usingcore.exportVariable()safe-outputs.envvariables: Excluded from job level as they belong in individual safe output jobs where they're actually usedGITHUB_AW_SAFE_OUTPUTS_CONFIG: Included at job level as it's needed by multiple steps for configuration purposesTesting
main_job_env_test.goThis change ensures that safe outputs functionality works correctly by providing only the necessary configuration environment variables at the job level scope while maintaining proper separation of concerns.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.