@@ -2,7 +2,7 @@ import { setFailed, setOutput } from '@actions/core';
22import { getParameters } from './methods/params' ;
33import { spawn } from 'child_process' ;
44
5- const dcdVersionString = '@devicecloud.dev/dcd@>=3.7.4 ' ;
5+ const dcdPackageName = '@devicecloud.dev/dcd' ;
66
77const escapeShellValue = ( value : string ) : string => {
88 // Escape special characters that could cause shell interpretation issues
@@ -60,6 +60,7 @@ const executeCommand = (
6060const getTestStatus = async (
6161 uploadId : string ,
6262 apiKey : string ,
63+ dcdVersionString : string ,
6364 apiUrl ?: string
6465) : Promise < StatusResponse | null > => {
6566 try {
@@ -77,8 +78,25 @@ const getTestStatus = async (
7778 }
7879} ;
7980
81+ const getLatestDcdVersion = async ( ) : Promise < string > => {
82+ try {
83+ const { output } = await executeCommand (
84+ `npm view ${ dcdPackageName } version` ,
85+ false
86+ ) ;
87+ const version = output . trim ( ) ;
88+ console . info ( `Latest DCD version from npm: ${ version } ` ) ;
89+ return `${ dcdPackageName } @${ version } ` ;
90+ } catch ( error ) {
91+ console . warn ( 'Failed to fetch latest DCD version, falling back to >=4.0.3:' , error ) ;
92+ return `${ dcdPackageName } @>=4.0.3` ;
93+ }
94+ } ;
95+
8096const run = async ( ) : Promise < void > => {
8197 try {
98+ const dcdVersionString = await getLatestDcdVersion ( ) ;
99+
82100 const {
83101 additionalAppBinaryIds,
84102 additionalAppFiles,
@@ -196,7 +214,7 @@ const run = async (): Promise<void> => {
196214 }
197215
198216 // Get the test status and results
199- const result = await getTestStatus ( uploadId , apiKey , apiUrl ) ;
217+ const result = await getTestStatus ( uploadId , apiKey , dcdVersionString , apiUrl ) ;
200218
201219 if ( result ) {
202220 // Set outputs based on the status results
0 commit comments