@@ -62,13 +62,17 @@ export type ReleaseAssetKind = "CodeQL bundle" | "private registry proxy";
6262 *
6363 * This function either returns the download URL for the asset for the first release we find, or
6464 * defaults to the assumed download URL for the asset on the default CodeQL Action repository on GitHub.com.
65- * In the latter case, this function does not guarantee that the asset actually exists.
65+ * In the latter case, this function does not guarantee that the asset actually exists by default.
66+ * Set `checkDefaultExists` to `true` to validate that the default exists.
6667 *
6768 * @param action The Action state.
6869 * @param apiDetails The details of the GitHub API in use.
6970 * @param tagName The name of the release tag we want to obtain the asset from.
7071 * @param assetName The name of the asset we should look for in the release.
7172 * @param [assetKind="CodeQL bundle"] The kind of asset we are looking for to show in log messages.
73+ * @param [checkDefaultExists=false]
74+ * Whether we should check that the asset URL that is defaulted to if the asset is not found in any other
75+ * location exists.
7276 * @returns A URL that we can use to download the asset.
7377 */
7478export async function getCodeQLAssetDownloadURL(
@@ -77,6 +81,7 @@ export async function getCodeQLAssetDownloadURL(
7781 tagName: string,
7882 assetName: string,
7983 assetKind: ReleaseAssetKind = "CodeQL bundle",
84+ checkDefaultExists: boolean = false,
8085): Promise<DownloadURL> {
8186 const codeQLActionRepository = getCodeQLActionRepository(action);
8287
@@ -100,8 +105,12 @@ export async function getCodeQLAssetDownloadURL(
100105 );
101106
102107 for (const [apiURL, repository] of uniqueDownloadSources) {
103- // If we've reached the final case, short-circuit the API check since we know the bundle exists and is public.
104- if (isSameDownloadSource(DEFAULT_DOWNLOAD_SOURCE, [apiURL, repository])) {
108+ // If we've reached the final case and `checkDefaultExists` is not enabled,
109+ // short-circuit the API check since we know the bundle exists and is public.
110+ if (
111+ !checkDefaultExists &&
112+ isSameDownloadSource(DEFAULT_DOWNLOAD_SOURCE, [apiURL, repository])
113+ ) {
105114 break;
106115 }
107116
0 commit comments