Support non-interactive metadata commands with ASC API key auth#3548
Open
Support non-interactive metadata commands with ASC API key auth#3548
Conversation
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.
|
Subscribed to pull request
Generated by CodeMention |
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>
|
✅ Thank you for adding the changelog entry! |
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
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.
Why
eas metadata:pullandeas metadata:pushpreviously required interactive Apple ID login, making them unusable in CI/CD pipelines. This adds--non-interactiveflag support and automatic ASC API key resolution so metadata commands can run headlessly.How
--non-interactiveflag to bothmetadata:pullandmetadata:pushcommandsgetAppStoreAuthAsyncto resolve ASC API keys from multiple sources in priority order:EXPO_ASC_API_KEY_PATH, etc.)eas.json(ascApiKeyPath,ascApiKeyId,ascApiKeyIssuerId)Test Plan
getAppStoreAuthAsynccovering all auth resolution paths (env vars, profile, credentials service, interactive fallback, non-interactive failure)downloadMetadataAsynccovering overwrite behavior in interactive vs non-interactive modeuploadMetadataAsynccovering validation error handling in both modes🤖 Generated with Claude Code