Fly deploy: auto-detect org slug for non-interactive apps create#39
Merged
Conversation
`fly apps create` requires `-o <org-slug>` when no TTY is attached (always in CI). The previous run failed with "org slug must be specified when not running interactively". Auto-detects from the token's accessible orgs (org-scoped tokens return exactly one). Falls back to a FLY_ORG repo variable if the auto-detect picks the wrong org or returns nothing. Handles both array and object shapes of `fly orgs list -j` output to survive flyctl version differences.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
After PR #38 unblocked flyctl on PATH, the deploy progressed to "Ensure Fly app exists" and failed with:
fly apps createrequires-o <org-slug>in CI (no TTY for the prompt).Fix
Auto-detect the org slug from the token's accessible orgs. Your token is org-scoped, so
fly orgs list -jreturns exactly one org and we use that. Falls back to aFLY_ORGrepo variable if auto-detect ever picks the wrong org (e.g., you switch to a multi-org token later).The
jqquery handles both possible response shapes (array vs object) to survive flyctl version differences.Test plan
auto-detected Fly org slug: <slug>thencreating app cotrackpro-talk in org <slug>curl https://cotrackpro-talk.fly.dev/healthreturns 200Generated by Claude Code