-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[eas-cli] skip creation of testflight group when there are already exisitng testflight groups + allow to opt out of the behavior by setting env var #2856
Open
szdziedzic
wants to merge
1
commit into
main
Choose a base branch
from
02-03-_eas-cli_skip_creation_of_testflight_group_when_there_are_already_exisitng_testflight_groups_allow_to_opt_out_of_the_behavior_by_setting_env_var
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,20 +13,40 @@ const AUTO_GROUP_NAME = 'Team (Expo)'; | |
* This allows users to instantly access their builds from TestFlight after it finishes processing. | ||
*/ | ||
export async function ensureTestFlightGroupExistsAsync(app: App): Promise<void> { | ||
const group = await ensureInternalGroupAsync(app); | ||
const users = await User.getAsync(app.context); | ||
const admins = users.filter(user => user.attributes.roles?.includes(UserRole.ADMIN)); | ||
|
||
await addAllUsersToInternalGroupAsync(group, admins); | ||
} | ||
if (process.env.EXPO_SKIP_TESTFLIGHT_SETUP) { | ||
Log.debug('EXPO_SKIP_TESTFLIGHT_SETUP is set, skipping TestFlight setup'); | ||
return; | ||
} | ||
|
||
async function ensureInternalGroupAsync(app: App): Promise<BetaGroup> { | ||
const groups = await app.getBetaGroupsAsync({ | ||
query: { | ||
includes: ['betaTesters'], | ||
}, | ||
}); | ||
|
||
if (groups.length > 0) { | ||
Log.debug(`Found ${groups.length} TestFlight groups`); | ||
Log.debug('Skipping creating a new TestFlight group'); | ||
return; | ||
} | ||
|
||
const group = await ensureInternalGroupAsync({ | ||
app, | ||
groups, | ||
}); | ||
const users = await User.getAsync(app.context); | ||
const admins = users.filter(user => user.attributes.roles?.includes(UserRole.ADMIN)); | ||
|
||
await addAllUsersToInternalGroupAsync(group, admins); | ||
} | ||
|
||
async function ensureInternalGroupAsync({ | ||
groups, | ||
app, | ||
}: { | ||
groups: BetaGroup[]; | ||
app: App; | ||
}): Promise<BetaGroup> { | ||
let betaGroup = groups.find(group => group.attributes.name === AUTO_GROUP_NAME); | ||
if (!betaGroup) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check is now redundant so could be a regular try / catch |
||
const spinner = ora().start('Creating TestFlight group...'); | ||
|
@@ -76,7 +96,14 @@ async function ensureInternalGroupAsync(app: App): Promise<BetaGroup> { | |
}) | ||
) { | ||
await BetaGroup.deleteAsync(app.context, { id: betaGroup.id }); | ||
return await ensureInternalGroupAsync(app); | ||
return await ensureInternalGroupAsync({ | ||
app, | ||
groups: await app.getBetaGroupsAsync({ | ||
query: { | ||
includes: ['betaTesters'], | ||
}, | ||
}), | ||
}); | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Expo CLI we usually format like
EXPO_NO_
.