Skip to content

Enable overwrite of values in .env#156

Merged
ncalteen merged 1 commit intomainfrom
ncalteen/overwrite-env
Feb 26, 2025
Merged

Enable overwrite of values in .env#156
ncalteen merged 1 commit intomainfrom
ncalteen/overwrite-env

Conversation

@ncalteen
Copy link
Copy Markdown
Collaborator

@ncalteen ncalteen commented Feb 26, 2025

This PR adds the overwrite configuration option when loading environment variables from the user's local .env file. This is restricted to the Node.js process @github/local-action runs in, so there is no risk of overwriting environment variables in the user's shell.

CC @githubdev58yashi

Closes #155

@ncalteen ncalteen self-assigned this Feb 26, 2025
Copilot AI review requested due to automatic review settings February 26, 2025 18:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR enables the overwrite of environment variables from the local .env file during the Node.js process execution.

  • Enables overwriting by adding the "override" option in the dotenv configuration.
  • Wraps the node_modules check in braces and introduces a commented placeholder for restoring environment variables.

Reviewed Changes

File Description
src/commands/run.ts Adds "override: true" to the dotenv config and updates error handling

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/commands/run.ts:64

  • Ensure that the version of the dotenv library in use supports the 'override' option, otherwise this change might lead to unintended behavior.
override: true

Tip: Leave feedback on Copilot's review comments with the 👎 and 👍 buttons to help improve review quality. Learn more

Comment thread src/commands/run.ts Outdated
@ncalteen ncalteen force-pushed the ncalteen/overwrite-env branch from 1cc25dd to 680f26f Compare February 26, 2025 18:47
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 26, 2025

🦙 MegaLinter status: ❌ ERROR

Descriptor Linter Files Fixed Errors Elapsed time
✅ ACTION actionlint 4 0 0.07s
✅ JAVASCRIPT prettier 11 0 1.08s
✅ JSON npm-package-json-lint yes no 3.29s
✅ JSON prettier 26 0 1.58s
✅ MARKDOWN markdownlint 8 0 1.32s
✅ REPOSITORY checkov yes no 26.52s
✅ REPOSITORY gitleaks yes no 3.95s
✅ REPOSITORY git_diff yes no 0.01s
✅ REPOSITORY grype yes no 25.0s
✅ REPOSITORY secretlint yes no 1.11s
❌ REPOSITORY trivy yes 1 13.53s
✅ REPOSITORY trivy-sbom yes no 1.35s
✅ REPOSITORY trufflehog yes no 30.1s
✅ TYPESCRIPT prettier 70 0 4.48s
✅ YAML prettier 22 0 0.91s
✅ YAML yamllint 22 0 0.74s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

@ncalteen ncalteen requested a review from Copilot February 26, 2025 18:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR enables environment variable overwriting by adding a configuration option when loading variables from the local .env file.

  • Adds an override: true option to the configuration call in the Node.js process.
  • Restricts the overwrite behavior to the local action runtime.

Reviewed Changes

File Description
src/commands/run.ts Introduces the override: true configuration for env

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

src/commands/run.ts:64

  • The property name 'override' in the config options is inconsistent with the PR title which refers to 'overwrite'. Consider renaming it to 'overwrite' for clarity and alignment with the PR intent.
override: true

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

@ncalteen ncalteen merged commit 8a9e775 into main Feb 26, 2025
@ncalteen ncalteen deleted the ncalteen/overwrite-env branch February 26, 2025 18:52
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.

Unable to Update Some Environment Variables

2 participants