Add support for common environment variables using GitHub Actions env: feature#39
Add support for common environment variables using GitHub Actions env: feature#39
Conversation
|
@dbanty 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
|
@copilot don't set the specific env var, just make sure generally env vars can be passed through |
Co-authored-by: dbanty <43723790+dbanty@users.noreply.github.com>
…bles Co-authored-by: dbanty <43723790+dbanty@users.noreply.github.com>
I've updated the implementation to use a generic The new
Testing confirmed the environment variables are correctly passed to the Docker container. Commit: a832433 |
|
@copilot is it possible for consumers to use the built in GitHub Actions |
Co-authored-by: dbanty <43723790+dbanty@users.noreply.github.com>
Yes! That's a much better approach. I've updated the implementation to use GitHub Actions' built-in The action now automatically passes through common environment variables like Users can now simply use: - name: Generate Client
env:
_JAVA_OPTIONS: "-DmaxYamlCodePoints=99999999"
uses: openapi-generators/openapitools-generator-action@v1
with:
generator: rust
openapi-file: spec.yamlThis is much cleaner and follows standard GitHub Actions conventions. Commit: bfb582b |
|
@copilot explain why only specific env vars are checked instead of passing through everything |
I used a whitelist approach for security and reliability reasons:
The current whitelist covers the most common OpenAPI generator needs. Would you prefer:
What's your preference for balancing security vs. flexibility? |
This PR adds support for passing common environment variables to the OpenAPI Generator CLI to handle large YAML documents and other configuration needs using GitHub Actions' built-in
env:feature.Problem
Users processing large OpenAPI specifications (like the DTMF Redfish specification) encounter this error:
Previously, there was no way to set environment variables like
_JAVA_OPTIONSto increase this limit when using the GitHub Action.Solution
Modified the action to automatically pass through common environment variables when they are set using GitHub Actions' native
env:feature. For security and reliability, the action uses a selective whitelist approach rather than passing through all environment variables, preventing accidental exposure of sensitive data and avoiding environment pollution from GitHub Actions runner variables.Usage
For handling large YAML files:
Multiple environment variables:
Supported Environment Variables
The action automatically passes through these environment variables when set:
_JAVA_OPTIONS- Java runtime options (useful for handling large YAML files)JAVA_OPTS- Additional Java optionsNODE_ENV- Node.js environment settingDEBUG- Debug mode flagOPENAPI_GENERATOR_VERSION- Override generator versionChanges
env:syntaxenv:approachBackward Compatibility
This is a fully backward-compatible change. All existing workflows continue to work unchanged. Environment variables are only passed through when explicitly set using GitHub Actions
env:.Fixes #38.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.