@@ -34,19 +34,19 @@ function getCodeQLCliVersionForRelease(release): string {
34
34
}
35
35
return cliVersionsFromMarkerFiles [ 0 ] ;
36
36
}
37
-
37
+
38
38
async function getBundleInfoFromRelease ( release ) : Promise < BundleInfo > {
39
39
return {
40
40
bundleVersion : release . tag_name . substring ( CODEQL_BUNDLE_PREFIX . length ) ,
41
41
cliVersion : getCodeQLCliVersionForRelease ( release )
42
42
} ;
43
43
}
44
-
44
+
45
45
async function getNewDefaults ( currentDefaults : Defaults ) : Promise < Defaults > {
46
46
const release = github . context . payload . release ;
47
47
console . log ( 'Updating default bundle as a result of the following release: ' +
48
48
`${ JSON . stringify ( release ) } .` )
49
-
49
+
50
50
const bundleInfo = await getBundleInfoFromRelease ( release ) ;
51
51
return {
52
52
bundleVersion : bundleInfo . bundleVersion ,
@@ -55,14 +55,15 @@ function getCodeQLCliVersionForRelease(release): string {
55
55
priorCliVersion : currentDefaults . cliVersion
56
56
} ;
57
57
}
58
-
58
+
59
59
async function main ( ) {
60
60
const previousDefaults : Defaults = JSON . parse ( fs . readFileSync ( '../../../src/defaults.json' , 'utf8' ) ) ;
61
61
const newDefaults = await getNewDefaults ( previousDefaults ) ;
62
+ // Update the source file in the repository. Calling workflows should subsequently rebuild
63
+ // the Action to update `lib/defaults.json`.
62
64
fs . writeFileSync ( '../../../src/defaults.json' , JSON . stringify ( newDefaults , null , 2 ) + "\n" ) ;
63
65
}
64
-
66
+
65
67
// Ideally, we'd await main() here, but that doesn't work well with `ts-node`.
66
68
// So instead we rely on the fact that Node won't exit until the event loop is empty.
67
69
main ( ) ;
68
-
0 commit comments