Skip to content

Support non-interactive metadata commands with ASC API key auth#3548

Open
EvanBacon wants to merge 4 commits intomainfrom
@evanbacon/metadata/headless
Open

Support non-interactive metadata commands with ASC API key auth#3548
EvanBacon wants to merge 4 commits intomainfrom
@evanbacon/metadata/headless

Conversation

@EvanBacon
Copy link
Contributor

Why

eas metadata:pull and eas metadata:push previously required interactive Apple ID login, making them unusable in CI/CD pipelines. This adds --non-interactive flag support and automatic ASC API key resolution so metadata commands can run headlessly.

How

  • Added --non-interactive flag to both metadata:pull and metadata:push commands
  • Enhanced getAppStoreAuthAsync to resolve ASC API keys from multiple sources in priority order:
    1. Environment variables (EXPO_ASC_API_KEY_PATH, etc.)
    2. Submit profile fields in eas.json (ascApiKeyPath, ascApiKeyId, ascApiKeyIssuerId)
    3. EAS credentials service (stored API keys)
    4. Interactive cookie auth (only when not in non-interactive mode)
  • In non-interactive mode: auto-overwrites existing store config on pull, and fails fast on validation errors on push (instead of prompting)
  • Clear error message when no API key is available in non-interactive mode

Test Plan

  • Added unit tests for getAppStoreAuthAsync covering all auth resolution paths (env vars, profile, credentials service, interactive fallback, non-interactive failure)
  • Added unit tests for downloadMetadataAsync covering overwrite behavior in interactive vs non-interactive mode
  • Added unit tests for uploadMetadataAsync covering validation error handling in both modes
  • All 121 existing metadata tests continue to pass
  • Typecheck passes across all 13 packages
cd packages/eas-cli && yarn test src/metadata/

🤖 Generated with Claude Code

Add a --non-interactive flag to metadata pull/push and thread nonInteractive through context and helper calls. Propagate the flag to ensureProjectConfiguredAsync, getProfilesAsync, getAppStoreAuthAsync, downloadMetadataAsync and uploadMetadataAsync so prompts are skipped or fail fast when non-interactive.

Improve App Store Connect auth resolution: try ASC API key from submit profile, then EAS credentials service (via GraphQL lookup), then environment variables; fall back to interactive cookie auth only when allowed. In non-interactive mode, throw a clear error if no ASC API key is available. Also update upload/download to auto-overwrite in non-interactive mode and make config validation in upload fail instead of prompting.

Minor: import/fs usage and GraphQL client types added, small logging improvements and error messages to aid non-interactive workflows.
Add unit tests for metadata auth, download, and upload flows and update App Store auth resolution to include team metadata.

- New tests: src/metadata/__tests__/auth.test.ts, download.test.ts, upload.test.ts covering API key resolution, interactive vs non-interactive behavior, telemetry, and validation prompts.
- auth.ts: refactor tryResolveAscApiKeyAsync to return ascApiKey plus optional teamId/teamName, read profile-provided keyP8 and prefer profile keys over stored keys, and include teamId/teamName/teamType (defaulting to COMPANY_OR_ORGANIZATION) when calling ensureAuthenticatedAsync.

These changes improve handling of ASC API keys and team info during authentication and add coverage for metadata CLI flows and edge cases.
@github-actions
Copy link

Subscribed to pull request

File Patterns Mentions
**/* @douglowder
packages/eas-cli/src/metadata/** @byCedric
packages/eas-cli/src/commands/metadata/** @byCedric

Generated by CodeMention

EvanBacon and others added 2 commits March 26, 2026 15:18
Replace import of fs-extra with Node's built-in fs and call fs.promises.readFile when loading the ASC API key. Update tests to mock fs.promises.readFile accordingly. This removes the dependency on fs-extra for this code path and aligns the readFile usage with the fs.promises API.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link

✅ Thank you for adding the changelog entry!

@codecov
Copy link

codecov bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 92.59259% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.01%. Comparing base (c9cdfd1) to head (a447920).

Files with missing lines Patch % Lines
packages/eas-cli/src/commands/metadata/pull.ts 0.00% 2 Missing ⚠️
packages/eas-cli/src/commands/metadata/push.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3548      +/-   ##
==========================================
+ Coverage   53.78%   54.01%   +0.23%     
==========================================
  Files         820      820              
  Lines       34965    35010      +45     
  Branches     7276     7225      -51     
==========================================
+ Hits        18802    18906     +104     
+ Misses      16072    16013      -59     
  Partials       91       91              

☔ View full report in Codecov by Sentry.
📢 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.

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