Skip to content

[eas-cli] Add eas env:set, deprecate env:create and env:update#4002

Draft
jonsamp wants to merge 2 commits into
mainfrom
jon/eng-15351-merge-eas-envcreate-and-eas-envupdate-into-eas-envset
Draft

[eas-cli] Add eas env:set, deprecate env:create and env:update#4002
jonsamp wants to merge 2 commits into
mainfrom
jon/eng-15351-merge-eas-envcreate-and-eas-envupdate-into-eas-envset

Conversation

@jonsamp

@jonsamp jonsamp commented Jul 11, 2026

Copy link
Copy Markdown
Member

Why

eas env:create and eas env:update force users to know up front whether a variable already exists, and the two commands use inconsistent flags (--name means the identifier in create but the rename target in update). This is janky. A single eas env:set that figures out create-vs-update is a much simpler mental model and mirrors the eas env:get / env:set verb pair (and gh secret set / gh variable set).

Closes ENG-15351.

How

  • Added eas env:set, which looks the variable up by name + scope + environment and updates it if it exists, creates it if it doesn't (idempotent upsert). No --force, no "already exists" error, no overwrite prompt. It logs Created/Updated so the outcome is clear.
  • Kept the existing flag model for now (--name + positional environment) so env:set is consistent with the rest of the env command family. A gh-style positional-name overhaul across get/set/delete is a deliberate follow-up.
  • Rename stays out of set (it isn't a "set" operation); it remains available on the deprecated env:update.
  • Deprecated eas env:create and eas env:update: both now print a deprecation notice pointing to env:set and say so in their descriptions, but keep their exact existing behavior/flags (incl. --force, --variable-name, rename) for backwards compatibility. They are intentionally not oclif aliases of set, because their flag surfaces are incompatible and a pure alias would break existing usage.

Follow-ups (not in this PR): documenting env:set on the docs site, the eventual removal of create/update after a deprecation window, and the positional-name overhaul.

Test Plan

  • New EnvSet.test.ts covering create-when-absent, update-when-present without --force (project + account scope), the positional environment argument, and prompting for missing flags.
  • Existing EnvCreate / EnvUpdate tests still pass with the added deprecation warning.
  • yarn test (env suite) 24/24, yarn typecheck clean, yarn lint 0 errors, yarn fmt:check clean.
  • Smoke-tested ./packages/eas-cli/bin/run env:set --help.

@linear-code

linear-code Bot commented Jul 11, 2026

Copy link
Copy Markdown

ENG-15351

Introduce `eas env:set`, which creates or updates an environment
variable in a single command (upsert). `env:create` and `env:update`
now warn that they are deprecated in favor of `env:set` while keeping
their existing behavior for backwards compatibility.
@jonsamp jonsamp force-pushed the jon/eng-15351-merge-eas-envcreate-and-eas-envupdate-into-eas-envset branch from 08c524a to f663abb Compare July 11, 2026 23:38
@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.39623% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.76%. Comparing base (4b1f785) to head (aa9bdbb).

Files with missing lines Patch % Lines
packages/eas-cli/src/commands/env/set.ts 93.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4002      +/-   ##
==========================================
+ Coverage   59.67%   59.76%   +0.09%     
==========================================
  Files         941      942       +1     
  Lines       41319    41423     +104     
  Branches     8675     8713      +38     
==========================================
+ Hits        24654    24751      +97     
- Misses      16571    16578       +7     
  Partials       94       94              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Look up the existing variable before resolving its value so updating a file
variable no longer requires re-passing `--type file`, mirroring the behavior
that `eas env:update` had. Also fix the `--value` flag description typo.
@github-actions

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

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.

1 participant