|
| 1 | +/* |
| 2 | +* The CodeQL CLI is the source of truth for language aliases. However, in some parts of the |
| 3 | +* Action it is practical to resolve language aliases before the CodeQL CLI has been installed. |
| 4 | +* Therefore we accept some duplication and store a snapshot of the known language aliases in |
| 5 | +* `src/known-language-aliases.json`. |
| 6 | +* |
| 7 | +* This module handles downloading and extracting a CodeQL bundle, running the CLI to resolve |
| 8 | +* language aliases, and writing the result back to `src/known-language-aliases.json`. |
| 9 | +*/ |
| 10 | + |
1 | 11 | import { execFileSync } from 'child_process'; |
2 | 12 | import * as fs from 'fs'; |
3 | 13 | import * as os from 'os'; |
@@ -27,6 +37,8 @@ const KNOWN_LANGUAGE_ALIASES_PATH = path.resolve( |
27 | 37 | export function assertSupportedPlatform( |
28 | 38 | platform: NodeJS.Platform = process.platform |
29 | 39 | ): void { |
| 40 | + // We'll only ever run this on Linux in CI, but it's useful to support macOS too |
| 41 | + // for local testing. |
30 | 42 | if (platform !== 'linux' && platform !== 'darwin') { |
31 | 43 | throw new Error( |
32 | 44 | `The update-bundle script must run on Linux or macOS. Current platform: ${platform}.` |
@@ -116,7 +128,7 @@ export async function updateKnownLanguageAliasesFromRelease( |
116 | 128 | }); |
117 | 129 |
|
118 | 130 | const codeqlCliPath = path.join(extractDir, 'codeql', 'codeql'); |
119 | | - console.log('Resolving language aliases using bundled CodeQL CLI'); |
| 131 | + console.log('Resolving language aliases using CodeQL CLI'); |
120 | 132 | const output = execFileSync( |
121 | 133 | codeqlCliPath, |
122 | 134 | ['resolve', 'languages', '--format=betterjson', '--extractor-include-aliases'], |
|
0 commit comments