Skip to content

Commit 5f044aa

Browse files
list all app ids if multiple found
1 parent c8f07c5 commit 5f044aa

4 files changed

Lines changed: 28 additions & 9 deletions

File tree

dist/index.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57499,6 +57499,7 @@ function checkAuthError(error) {
5749957499
}
5750057500
}
5750157501
async function GetAppId(project) {
57502+
var _a, _b, _c;
5750257503
await getOrCreateClient(project);
5750357504
const { data: response, error } = await appStoreConnectClient.api.AppsService.appsGetCollection({
5750457505
query: { 'filter[bundleId]': [project.bundleId] }
@@ -57513,6 +57514,15 @@ async function GetAppId(project) {
5751357514
if (response.data.length === 0) {
5751457515
throw new Error(`No apps found for bundle id ${project.bundleId}`);
5751557516
}
57517+
if (response.data.length > 1) {
57518+
core.warning(`Multiple apps found for bundle id ${project.bundleId}!`);
57519+
for (const app of response.data) {
57520+
core.info(`[${app.id}] ${(_a = app.attributes) === null || _a === void 0 ? void 0 : _a.bundleId}`);
57521+
if (project.bundleId.length === ((_c = (_b = app.attributes) === null || _b === void 0 ? void 0 : _b.bundleId) === null || _c === void 0 ? void 0 : _c.length)) {
57522+
return app.id;
57523+
}
57524+
}
57525+
}
5751657526
return response.data[0].id;
5751757527
}
5751857528
async function GetLatestBundleVersion(project) {
@@ -57684,7 +57694,7 @@ async function pollForValidBuild(project, maxRetries = 60, interval = 30) {
5768457694
core.debug(`Polling build validation...`);
5768557695
await new Promise(resolve => setTimeout(resolve, interval * 1000));
5768657696
let retries = 0;
57687-
while (retries < maxRetries) {
57697+
while (++retries < maxRetries) {
5768857698
core.info(`Polling for build... Attempt ${retries}/${maxRetries}`);
5768957699
let { preReleaseVersion, build } = await getLastPreReleaseVersionAndBuild(project);
5769057700
if (preReleaseVersion) {
@@ -58157,7 +58167,7 @@ async function GetProjectDetails(credential, xcodeVersion) {
5815758167
finally {
5815858168
await plistHandle.close();
5815958169
}
58160-
core.info(`----- Info.plist content: -----\n${infoPlistContent}\n-----------------------------------`);
58170+
core.info(`------- Info.plist content: -------\n${infoPlistContent}\n-----------------------------------`);
5816158171
return projectRef;
5816258172
}
5816358173
async function checkSimulatorsAvailable(platform) {
@@ -58506,7 +58516,7 @@ async function getExportOptions(projectRef) {
5850658516
const exportOptionsHandle = await fs.promises.open(exportOptionsPath, fs.constants.O_RDONLY);
5850758517
try {
5850858518
const exportOptionContent = await fs.promises.readFile(exportOptionsHandle, 'utf8');
58509-
core.info(`----- Export options content: -----${exportOptionContent}\n-----------------------------------`);
58519+
core.info(`----- Export options content: -----\n${exportOptionContent}\n-----------------------------------`);
5851058520
const exportOptions = plist.parse(exportOptionContent);
5851158521
projectRef.exportOption = exportOptions['method'];
5851258522
}
@@ -58718,7 +58728,7 @@ async function UploadApp(projectRef) {
5871858728
core.debug(outputJson);
5871958729
try {
5872058730
const whatsNew = await getWhatsNew();
58721-
core.info(`\n-------------- what's new --------------\n${whatsNew}\n------------------------------------------\n`);
58731+
core.info(`\n--------------- what's new ---------------\n${whatsNew}\n------------------------------------------\n`);
5872258732
await (0, AppStoreConnectClient_1.UpdateTestDetails)(projectRef, whatsNew);
5872358733
}
5872458734
catch (error) {

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/AppStoreConnectClient.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ export async function GetAppId(project: XcodeProject): Promise<string> {
6363
if (response.data.length === 0) {
6464
throw new Error(`No apps found for bundle id ${project.bundleId}`);
6565
}
66+
if (response.data.length > 1) {
67+
core.warning(`Multiple apps found for bundle id ${project.bundleId}!`);
68+
for (const app of response.data) {
69+
core.info(`[${app.id}] ${app.attributes?.bundleId}`);
70+
if (project.bundleId.length === app.attributes?.bundleId?.length) {
71+
return app.id;
72+
}
73+
}
74+
}
6675
return response.data[0].id;
6776
}
6877

@@ -240,7 +249,7 @@ async function pollForValidBuild(project: XcodeProject, maxRetries: number = 60,
240249
core.debug(`Polling build validation...`);
241250
await new Promise(resolve => setTimeout(resolve, interval * 1000));
242251
let retries = 0;
243-
while (retries < maxRetries) {
252+
while (++retries < maxRetries) {
244253
core.info(`Polling for build... Attempt ${retries}/${maxRetries}`);
245254
let { preReleaseVersion, build } = await getLastPreReleaseVersionAndBuild(project);
246255
if (preReleaseVersion) {

src/xcode.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export async function GetProjectDetails(credential: AppleCredential, xcodeVersio
178178
} finally {
179179
await plistHandle.close();
180180
}
181-
core.info(`----- Info.plist content: -----\n${infoPlistContent}\n-----------------------------------`);
181+
core.info(`------- Info.plist content: -------\n${infoPlistContent}\n-----------------------------------`);
182182
return projectRef;
183183
}
184184

@@ -533,7 +533,7 @@ async function getExportOptions(projectRef: XcodeProject): Promise<void> {
533533
const exportOptionsHandle = await fs.promises.open(exportOptionsPath, fs.constants.O_RDONLY);
534534
try {
535535
const exportOptionContent = await fs.promises.readFile(exportOptionsHandle, 'utf8');
536-
core.info(`----- Export options content: -----${exportOptionContent}\n-----------------------------------`);
536+
core.info(`----- Export options content: -----\n${exportOptionContent}\n-----------------------------------`);
537537
const exportOptions = plist.parse(exportOptionContent);
538538
projectRef.exportOption = exportOptions['method'];
539539
} finally {
@@ -744,7 +744,7 @@ export async function UploadApp(projectRef: XcodeProject) {
744744
core.debug(outputJson);
745745
try {
746746
const whatsNew = await getWhatsNew();
747-
core.info(`\n-------------- what's new --------------\n${whatsNew}\n------------------------------------------\n`);
747+
core.info(`\n--------------- what's new ---------------\n${whatsNew}\n------------------------------------------\n`);
748748
await UpdateTestDetails(projectRef, whatsNew);
749749
} catch (error) {
750750
log(`Failed to upload test details!\n${error}`, 'error');

0 commit comments

Comments
 (0)