@@ -57680,43 +57680,51 @@ async function updateBetaBuildLocalization(betaBuildLocalization, whatsNew) {
5768057680 return betaBuildLocalization;
5768157681}
5768257682async function pollForValidBuild(project, maxRetries = 60, interval = 30) {
57683- var _a, _b;
57683+ var _a, _b, _c ;
5768457684 core.debug(`Polling build validation...`);
5768557685 await new Promise(resolve => setTimeout(resolve, interval * 1000));
5768657686 let retries = 0;
57687+ let lastMessage = '';
5768757688 while (retries < maxRetries) {
57688- core.debug(`Polling for build... Attempt ${++retries}/${maxRetries}`);
57689+ lastMessage = `Polling for build... Attempt ${retries}/${maxRetries}`;
57690+ core.debug(lastMessage);
5768957691 let { preReleaseVersion, build } = await getLastPreReleaseVersionAndBuild(project);
57690- if (!preReleaseVersion) {
57691- throw new Error(`Failed to get the last pre-release for version ${project.versionString}!`);
57692- }
57693- if (!build) {
57694- build = await getLastPrereleaseBuild(preReleaseVersion);
57695- }
57696- if (!build) {
57697- throw new Error(`Build ${preReleaseVersion.id} not found!`);
57698- }
57699- const normalizedBuildVersion = normalizeVersion((_a = build.attributes) === null || _a === void 0 ? void 0 : _a.version);
57700- const normalizedProjectVersion = normalizeVersion(project.bundleVersion);
57701- switch ((_b = build.attributes) === null || _b === void 0 ? void 0 : _b.processingState) {
57702- case 'VALID':
57703- if (normalizedBuildVersion === normalizedProjectVersion) {
57704- core.debug(`Build ${build.attributes.version} is VALID`);
57705- return build;
57706- }
57707- else {
57708- core.debug(`Build ${build.attributes.version} is VALID but not the latest version ${project.bundleVersion}!`);
57692+ if (preReleaseVersion) {
57693+ if (!build) {
57694+ build = await getLastPrereleaseBuild(preReleaseVersion);
57695+ }
57696+ if (build) {
57697+ const normalizedBuildVersion = normalizeVersion((_a = build.attributes) === null || _a === void 0 ? void 0 : _a.version);
57698+ const normalizedProjectVersion = normalizeVersion(project.bundleVersion);
57699+ switch ((_b = build.attributes) === null || _b === void 0 ? void 0 : _b.processingState) {
57700+ case 'VALID':
57701+ if (normalizedBuildVersion === normalizedProjectVersion) {
57702+ core.debug(`Build ${build.attributes.version} is VALID`);
57703+ return build;
57704+ }
57705+ else {
57706+ lastMessage = `Build ${build.attributes.version} is VALID but not the latest version ${project.bundleVersion}!`;
57707+ }
57708+ break;
57709+ case 'FAILED':
57710+ case 'INVALID':
57711+ throw new Error(`Build ${build.attributes.version} === ${build.attributes.processingState}!`);
57712+ default:
57713+ lastMessage = `Build ${build.attributes.version} is ${build.attributes.processingState}...`;
57714+ break;
5770957715 }
57710- break;
57711- case 'FAILED':
57712- case 'INVALID':
57713- throw new Error(`Build ${build.attributes.version} is ${build.attributes.processingState}!`);
57714- default:
57715- core.debug(`Build ${build.attributes.version} is ${build.attributes.processingState}...`);
57716- break ;
57716+ }
57717+ else {
57718+ lastMessage = `No build found for ${(_c = preReleaseVersion.attributes) === null || _c === void 0 ? void 0 : _c.version}!`;
57719+ }
57720+ }
57721+ else {
57722+ lastMessage = `No pre-release version found for ${project.versionString}!` ;
5771757723 }
57724+ core.debug(lastMessage);
5771857725 await new Promise(resolve => setTimeout(resolve, interval * 1000));
5771957726 }
57727+ core.error(lastMessage);
5772057728 throw new Error('Timed out waiting for valid build!');
5772157729}
5772257730async function UpdateTestDetails(project, whatsNew) {
0 commit comments