Skip to content

Commit 7d191f2

Browse files
authored
Merge pull request #4525 from GtechGovind/feat/show-cli-release-notes
Offer CodeQL CLI release notes after updates
2 parents fe1ee67 + 10f3763 commit 7d191f2

4 files changed

Lines changed: 67 additions & 4 deletions

File tree

extensions/ql-vscode/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## [UNRELEASED]
44

5+
- After an extension-managed CodeQL CLI update, the notification now offers to open the CLI release notes instead of the extension log. [#1095](https://github.com/github/vscode-codeql/issues/1095)
6+
57
## 1.17.8 - 17 July 2026
68

79
- Fix a bug where installing or updating the CodeQL CLI could hang indefinitely while extracting the downloaded archive. Extraction now reports an error if a file cannot be written, and aborts with a clear message if no progress is made within the download timeout (for example due to slow or networked storage, or security software). [#4455](https://github.com/github/vscode-codeql/pull/4455)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { env, Uri } from "vscode";
2+
import { showInformationMessageWithAction } from "../../common/vscode/dialog";
3+
4+
export const codeQlCliReleaseNotesUrl =
5+
"https://github.com/github/codeql-cli-binaries/blob/main/CHANGELOG.md";
6+
7+
/**
8+
* Offers release notes after the extension updates its managed CodeQL CLI.
9+
*/
10+
export async function offerCodeQlCliReleaseNotes(
11+
updateMessage: string,
12+
): Promise<void> {
13+
if (
14+
await showInformationMessageWithAction(updateMessage, "Show release notes")
15+
) {
16+
await env.openExternal(Uri.parse(codeQlCliReleaseNotesUrl));
17+
}
18+
}

extensions/ql-vscode/src/extension.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import {
6565
showBinaryChoiceDialog,
6666
showInformationMessageWithAction,
6767
} from "./common/vscode/dialog";
68+
import { offerCodeQlCliReleaseNotes } from "./codeql-cli/distribution/release-notes";
6869
import {
6970
asError,
7071
assertNever,
@@ -555,10 +556,9 @@ async function installOrUpdateDistributionWithProgressTitle(
555556
);
556557

557558
await ctx.globalState.update(shouldUpdateOnNextActivationKey, false);
558-
void showAndLogInformationMessage(
559-
extLogger,
560-
`CodeQL CLI updated to version "${result.updatedRelease.name}".`,
561-
);
559+
const updateMessage = `CodeQL CLI updated to version "${result.updatedRelease.name}".`;
560+
void extLogger.log(updateMessage);
561+
void offerCodeQlCliReleaseNotes(updateMessage);
562562
}
563563
break;
564564
default:
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { env, Uri, window } from "vscode";
2+
import type { MessageItem } from "vscode";
3+
import {
4+
codeQlCliReleaseNotesUrl,
5+
offerCodeQlCliReleaseNotes,
6+
} from "../../../../src/codeql-cli/distribution/release-notes";
7+
8+
describe("offerCodeQlCliReleaseNotes", () => {
9+
const updateMessage = 'CodeQL CLI updated to version "v2.23.0".';
10+
let showInformationMessageSpy: jest.SpiedFunction<
11+
typeof window.showInformationMessage
12+
>;
13+
let openExternalSpy: jest.SpiedFunction<typeof env.openExternal>;
14+
15+
beforeEach(() => {
16+
showInformationMessageSpy = jest
17+
.spyOn(window, "showInformationMessage")
18+
.mockResolvedValue(undefined);
19+
openExternalSpy = jest.spyOn(env, "openExternal").mockResolvedValue(true);
20+
});
21+
22+
it("opens the CLI changelog when the release-notes action is selected", async () => {
23+
showInformationMessageSpy.mockImplementationOnce((...args) =>
24+
Promise.resolve(args[1] as MessageItem),
25+
);
26+
27+
await offerCodeQlCliReleaseNotes(updateMessage);
28+
29+
expect(showInformationMessageSpy).toHaveBeenCalledWith(updateMessage, {
30+
title: "Show release notes",
31+
isCloseAffordance: false,
32+
});
33+
expect(openExternalSpy).toHaveBeenCalledWith(
34+
Uri.parse(codeQlCliReleaseNotesUrl),
35+
);
36+
});
37+
38+
it("does not open the changelog when the message is dismissed", async () => {
39+
await offerCodeQlCliReleaseNotes(updateMessage);
40+
41+
expect(openExternalSpy).not.toHaveBeenCalled();
42+
});
43+
});

0 commit comments

Comments
 (0)