@@ -29933,7 +29933,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
2993329933const core_1 = __nccwpck_require__(2186);
2993429934const params_1 = __nccwpck_require__(5966);
2993529935const child_process_1 = __nccwpck_require__(2081);
29936- const dcdVersionString = '@devicecloud.dev/dcd@>=3.7.4 ';
29936+ const dcdPackageName = '@devicecloud.dev/dcd';
2993729937const escapeShellValue = (value) => {
2993829938 // Escape special characters that could cause shell interpretation issues
2993929939 return value.replace(/(["\\'$`!\s\[\]{}()&|;<>*?#^~])/g, '\\$1');
@@ -29965,7 +29965,7 @@ const executeCommand = (command, log = true) => {
2996529965 });
2996629966 });
2996729967};
29968- const getTestStatus = (uploadId, apiKey, apiUrl) => __awaiter(void 0, void 0, void 0, function* () {
29968+ const getTestStatus = (uploadId, apiKey, dcdVersionString, apiUrl) => __awaiter(void 0, void 0, void 0, function* () {
2996929969 try {
2997029970 let command = `npx --yes "${dcdVersionString}" status --json --upload-id ${uploadId} --api-key ${escapeShellValue(apiKey)}`;
2997129971 if (apiUrl) {
@@ -29979,9 +29979,22 @@ const getTestStatus = (uploadId, apiKey, apiUrl) => __awaiter(void 0, void 0, vo
2997929979 return null;
2998029980 }
2998129981});
29982+ const getLatestDcdVersion = () => __awaiter(void 0, void 0, void 0, function* () {
29983+ try {
29984+ const { output } = yield executeCommand(`npm view ${dcdPackageName} version`, false);
29985+ const version = output.trim();
29986+ console.info(`Latest DCD version from npm: ${version}`);
29987+ return `${dcdPackageName}@${version}`;
29988+ }
29989+ catch (error) {
29990+ console.warn('Failed to fetch latest DCD version, falling back to >=4.0.3:', error);
29991+ return `${dcdPackageName}@>=4.0.3`;
29992+ }
29993+ });
2998229994const run = () => __awaiter(void 0, void 0, void 0, function* () {
2998329995 var _a;
2998429996 try {
29997+ const dcdVersionString = yield getLatestDcdVersion();
2998529998 const { additionalAppBinaryIds, additionalAppFiles, androidApiLevel, androidDevice, apiKey, apiUrl, appBinaryId, appFilePath, async, config, deviceLocale, downloadArtifacts, env, excludeFlows, excludeTags, googlePlay, ignoreShaCheck, includeTags, iOSVersion, iosDevice, jsonFile, maestroVersion, name, orientation, report, retry, workspaceFolder, x86Arch, runnerType, skipChromeOnboarding, debug, moropoV1ApiKey, } = yield (0, params_1.getParameters)();
2998629999 const params = {
2998730000 'additional-app-binary-ids': additionalAppBinaryIds,
@@ -30053,7 +30066,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
3005330066 throw new Error('Failed to get upload ID from console URL');
3005430067 }
3005530068 // Get the test status and results
30056- const result = yield getTestStatus(uploadId, apiKey, apiUrl);
30069+ const result = yield getTestStatus(uploadId, apiKey, dcdVersionString, apiUrl);
3005730070 if (result) {
3005830071 // Set outputs based on the status results
3005930072 (0, core_1.setOutput)('DEVICE_CLOUD_CONSOLE_URL', result.consoleUrl || '');
0 commit comments