Skip to content

Commit 43ec06f

Browse files
committed
Offer CodeQL CLI release notes after updates
1 parent 29fa344 commit 43ec06f

4 files changed

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

0 commit comments

Comments
 (0)