@@ -13,10 +13,11 @@ import {
13
13
} from './utils' ;
14
14
import type { ExecOptions } from '@actions/exec/lib/interfaces' ;
15
15
16
+ const PLATFORM = platform ( ) ;
16
17
// REFER: https://docs.codeclimate.com/docs/configuring-test-coverage#locations-of-pre-built-binaries
17
18
/** Canonical download URL for the official CodeClimate reporter. */
18
19
export const DOWNLOAD_URL = `https://codeclimate.com/downloads/test-reporter/test-reporter-latest-${
19
- platform ( ) === 'win32' ? 'windows' : platform ( )
20
+ PLATFORM === 'win32' ? 'windows' : PLATFORM
20
21
} -${ arch ( ) === 'arm64' ? 'arm64' : 'amd64' } `;
21
22
/** Local file name of the CodeClimate reporter. */
22
23
export const EXECUTABLE = './cc-reporter' ;
@@ -144,7 +145,13 @@ async function getLocationLines(
144
145
. map ( ( pat ) => pat . trim ( ) ) ;
145
146
146
147
const patternsAndFormats = coverageLocationPatternsLines . map ( ( line ) => {
147
- const lineParts = line . split ( ':' ) ;
148
+ let lineParts = line . split ( ':' ) ;
149
+ // On Windows, if the glob received an absolute path, the path will
150
+ // include the Drive letter and the path – for example, `C:\Users\gp\projects\cc\*.lcov:lcov`
151
+ // which leads to 2 colons. So we handle this special case.
152
+ if ( PLATFORM === 'win32' && ( line . match ( / : / g) || [ ] ) . length > 1 ) {
153
+ lineParts = [ lineParts . slice ( 0 , - 1 ) . join ( ':' ) , lineParts . slice ( - 1 ) [ 0 ] ] ;
154
+ }
148
155
const format = lineParts . slice ( - 1 ) [ 0 ] ;
149
156
const pattern = lineParts . slice ( 0 , - 1 ) [ 0 ] ;
150
157
return { format, pattern } ;
0 commit comments