@@ -13,6 +13,9 @@ export interface RemoteFileAddress {
1313 ref : string ;
1414}
1515
16+ /** The default file path to use in configuration file shorthands. */
17+ export const DEFAULT_CONFIG_FILE_NAME = ".github/codeql-action.yaml" ;
18+
1619/** The default ref to use in configuration file shorthands. */
1720export const DEFAULT_CONFIG_FILE_REF = "main" ;
1821
@@ -26,16 +29,12 @@ export const DEFAULT_CONFIG_FILE_REF = "main";
2629export function parseRemoteFileAddress ( configFile : string ) : RemoteFileAddress {
2730 // retrieve the various parts of the config location, and ensure they're present
2831 const format = new RegExp (
29- "(?<owner>[^/]+)/(?<repo>[^/]+)/(?<path>[^@]+)(@(?<ref>.*))?" ,
32+ "(?<owner>[^/]+)/(?<repo>[^/@ ]+)( /(?<path>[^@]+))? (@(?<ref>.*))?" ,
3033 ) ;
3134 const pieces = format . exec ( configFile ) ;
3235
3336 // Check that the regular expression matched and that we have at least the required components.
34- if (
35- ! pieces ?. groups ?. owner ||
36- ! pieces ?. groups ?. repo ||
37- ! pieces ?. groups ?. path
38- ) {
37+ if ( ! pieces ?. groups ?. owner || ! pieces ?. groups ?. repo ) {
3938 throw new ConfigurationError (
4039 errorMessages . getConfigFileRepoFormatInvalidMessage ( configFile ) ,
4140 ) ;
@@ -44,7 +43,7 @@ export function parseRemoteFileAddress(configFile: string): RemoteFileAddress {
4443 return {
4544 owner : pieces . groups . owner ,
4645 repo : pieces . groups . repo ,
47- path : pieces . groups . path ,
46+ path : pieces . groups . path || DEFAULT_CONFIG_FILE_NAME ,
4847 ref : pieces . groups . ref || DEFAULT_CONFIG_FILE_REF ,
4948 } ;
5049}
0 commit comments