Visitar URL original
Merge releases/v4 into releases/v3 by github-actions[bot] · Pull Request #4304 · github/codeql-action · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d805a56
Update `.editorconfig` with explicit `indent_size` for YAML
mbg Oct 30, 2026
3f9319d
Update VSCode settings with YAML formatter
mbg Oct 30, 2026
fef5200
Add `prettier` as dev dependency
mbg Oct 30, 2026
2c6d525
Apply consistent YAML formatting
mbg Oct 30, 2026
6c2d540
Move subprocess helpers from `update-release-branch.ts` to `command.ts`
mbg Jul 31, 2026
c8db21e
Convert `check-js.sh` to TypeScript
mbg Jul 31, 2026
549d739
Refactor `check-js.ts` into separate functions
mbg Oct 30, 2026
b2e3b75
Rename to `check-unchanged` and add YAML check
mbg Oct 30, 2026
ff6ba28
Fix `checkUnchanged` returning `-1`
mbg Oct 30, 2026
c434c1b
Fix missing `core.summary.write` call
mbg Oct 30, 2026
878c513
Fix inconsistent quoting in `diffRangeExtensionPackContents` and empt…
mbg Oct 30, 2026
69543ab
Configure VSCode to use local version of `prettier`
mbg Oct 30, 2026
fab591c
Run `lint-fix` with newer version of `prettier`
mbg Oct 30, 2026
9fe80b6
Avoid ESM-specific entry check for now
mbg Oct 30, 2026
9151e90
Merge branch 'main' into mbg/ci/validate-yaml
mbg Nov 2, 2026
b05fe69
fix: decode SARIF location URIs in diff-informed alert filtering
sam-robson Nov 2, 2026
9bc74b1
Create a changenote for bundle updates instead of editing the changelog
henrymercer Nov 2, 2026
3952845
Remove unused `updateChangelog` from `bundle-changelog.ts`
henrymercer Nov 2, 2026
70417cd
Merge remote-tracking branch 'origin/main' into mbg/ci/validate-yaml
mbg Nov 3, 2026
0d5ac7a
Merge pull request #4285 from github/henrymercer/automated-change-notes
henrymercer Nov 3, 2026
3b22011
Bump glob from 13.0.6 to 14.0.3 in /pr-checks
dependabot[bot] Nov 3, 2026
dc4b73f
Bump node-forge from 1.4.0 to 1.4.1
dependabot[bot] Nov 3, 2026
eb1e5bd
Update changelog and version after v4.39.2
github-actions[bot] Nov 3, 2026
3062620
Rebuild
github-actions[bot] Nov 3, 2026
093c0af
Merge pull request #4290 from github/mergeback/v4.39.2-to-main-1fc58d04
henrymercer Nov 3, 2026
7b8e4ce
Maintain action versions by workflow in `sync-back.ts`
mbg Nov 3, 2026
cc88e02
Update version of `actions/download-artifact` in `unsupported-macos` …
mbg Nov 3, 2026
de3ece6
Merge branch 'main' into mbg/ci/fix-sync-back
mbg Nov 3, 2026
7bcfa1e
Merge branch 'main' into mbg/ci/validate-yaml
mbg Nov 3, 2026
8a05ce6
Update JSDoc for `scanGeneratedWorkflows`
mbg Nov 3, 2026
1f8cacc
Merge pull request #4292 from github/mbg/ci/fix-sync-back
mbg Nov 3, 2026
7c5ee8e
Merge branch 'main' into dependabot/npm_and_yarn/node-forge-1.4.1
mbg Nov 3, 2026
6a39e2e
Merge branch 'main' into dependabot/npm_and_yarn/pr-checks/glob-14.0.3
mbg Nov 3, 2026
d0468de
Rebuild
github-actions[bot] Nov 3, 2026
875ac0c
Merge pull request #4287 from github/dependabot/npm_and_yarn/pr-check…
mbg Nov 3, 2026
c5320e3
Merge pull request #4288 from github/dependabot/npm_and_yarn/node-for…
mbg Nov 3, 2026
913e1bb
Merge pull request #4283 from github/sam-robson/decode-diff-informed-…
sam-robson Nov 3, 2026
160e547
Merge remote-tracking branch 'origin/main' into mbg/ci/validate-yaml
mbg Nov 4, 2026
8eb7cdf
Use normal `.editorconfig` pattern
mbg Nov 4, 2026
7287bb3
Remove `exclude` entry that's no longer needed
mbg Nov 4, 2026
cea289b
Return different exit code when a language is not recognised
mbg Nov 4, 2026
8cd4dfa
Merge pull request #4280 from github/mbg/ci/validate-yaml
mbg Nov 4, 2026
f532ac5
Update `glob` to `14.0.3`
mbg Nov 4, 2026
064910b
Merge pull request #4297 from github/mbg/update-glob
mbg Nov 4, 2026
24393f8
Update changelog for v4.39.3
github-actions[bot] Nov 4, 2026
33d7b85
Merge pull request #4299 from github/update-v4.39.3-064910ba2
sam-robson Nov 4, 2026
11db0b7
Revert "Update version and changelog for v3.39.2"
github-actions[bot] Nov 4, 2026
268f88d
Revert "Rebuild"
github-actions[bot] Nov 4, 2026
3a2a01e
Merge remote-tracking branch 'origin/releases/v4' into backport-v3.39…
github-actions[bot] Nov 4, 2026
205ef9f
Update version and changelog for v3.39.3
github-actions[bot] Nov 4, 2026
8f01efb
chore: resolve merge conflicts in action.yml files
sam-robson Nov 4, 2026
5695bd7
Rebuild
sam-robson Nov 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/update-bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ jobs:
echo "CLI_VERSION=$cli_version" | tee -a "$GITHUB_ENV"
echo "PR_URL=$pr_url" | tee -a "$GITHUB_ENV"

- name: Create changelog note
- name: Create changenote
run: |
npx tsx pr-checks/bundle-changelog.ts

- name: Push changelog note
- name: Push changenote
run: |
git commit -am "Add changelog note"
git add unreleased-change-notes
git commit -m "Add changenote"
git push
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs.

## [UNRELEASED]

No user facing changes.

## 4.39.2 - 03 Nov 2026

- Update default CodeQL bundle version to [2.27.4](https://github.com/github/codeql-action/releases/tag/codeql-bundle-v2.27.4). [#4284](https://github.com/github/codeql-action/pull/4284)
Expand Down
2 changes: 1 addition & 1 deletion lib/entry-points.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codeql",
"version": "4.39.2",
"version": "4.39.3",
"private": true,
"description": "CodeQL action",
"scripts": {
Expand Down
65 changes: 9 additions & 56 deletions pr-checks/bundle-changelog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,13 @@ import { afterEach, beforeEach, describe, it } from "node:test";

import {
CLI_VERSION_ENV_VAR,
getChangenote,
getCLIVersion,
getPRNumber,
getPRUrl,
PR_URL_ENV_VAR,
updateChangelog,
} from "./bundle-changelog";
import {
EMPTY_CHANGELOG,
NO_CHANGES_STR,
UNRELEASED_PLACEHOLDER,
} from "./changelog";
import { isValidChangenoteContent } from "./changelog/validate";

let testDir: string;

Expand Down Expand Up @@ -85,58 +81,15 @@ describe("getPRNumber", async () => {
});
});

const testChangelog = `${EMPTY_CHANGELOG.trimEnd()}

## 4.23.7

- Other change

## 4.23.6

${NO_CHANGES_STR}`;

const expectedChangelog = `# CodeQL Action Changelog

## ${UNRELEASED_PLACEHOLDER}

- Update default CodeQL bundle version to

## 4.23.7

- Other change

## 4.23.6

${NO_CHANGES_STR}`;

describe("updateChangelog", async () => {
await it("removes `NO_CHANGES_STR` if present in [UNRELEASED] section", async () => {
const result = updateChangelog(EMPTY_CHANGELOG, "");
assert.ok(!result.includes(NO_CHANGES_STR));
});

await it("doesn't remove `NO_CHANGES_STR` if present in versioned section", async () => {
const result = updateChangelog(
EMPTY_CHANGELOG.replace(UNRELEASED_PLACEHOLDER, "1.2.3"),
"",
describe("getChangenote", async () => {
await it("returns a note linking to the bundle release and the PR", async () => {
assert.equal(
getChangenote("1.2.3", testPrUrl),
"- Update default CodeQL bundle version to [1.2.3](https://github.com/github/codeql-action/releases/tag/codeql-bundle-v1.2.3). [#42](https://github.com/github/codeql-action/pulls/42)\n",
);
assert.ok(result.includes(NO_CHANGES_STR));
});

await it("throws if there are no sections", async () => {
assert.throws(() => {
updateChangelog(
"# CodeQL Action Changelog",
"- Update default CodeQL bundle version to",
);
});
});

await it("adds note at the end of the first section", async () => {
const result = updateChangelog(
testChangelog,
"- Update default CodeQL bundle version to",
);
assert.deepEqual(result, expectedChangelog);
await it("returns valid changenote content", async () => {
assert.ok(isValidChangenoteContent(getChangenote("1.2.3", testPrUrl)));
});
});
76 changes: 23 additions & 53 deletions pr-checks/bundle-changelog.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
#!/usr/bin/env npx tsx

/**
* Updates the changelog with a change note for an updated CodeQL CLI bundle.
* Creates a changenote file for an update to the default CodeQL CLI bundle.
*/

import * as fs from "node:fs";
import * as path from "node:path";

import {
parseChangelog,
renderChangelog,
UNRELEASED_PLACEHOLDER,
} from "./changelog";
import { CHANGELOG_FILE, CLI_BUNDLE_RELEASE_URL_PREFIX } from "./config";
import { CHANGENOTES_DIR, CLI_BUNDLE_RELEASE_URL_PREFIX } from "./config";
import { getErrorMessage } from "./util";

export const CLI_VERSION_ENV_VAR = "CLI_VERSION";
Expand Down Expand Up @@ -58,65 +54,39 @@ export function getPRNumber(prUrl: string) {
}

/**
* Updates `changelog` by adding `changelogNote` to the first section.
* Returns the contents of the changenote file for an update to the default
* CodeQL CLI bundle.
*
* @param contents The existing changelog contents.
* @param changelogNote The note to add to the first section.
* @param cliVersion The CodeQL CLI version of the new default bundle.
* @param prUrl The URL of the PR that updates the default bundle.
* @throws If the PR number can't be determined from `prUrl`.
*/
export function updateChangelog(contents: string, changelogNote: string) {
// If the "[UNRELEASED]" section starts with "no user facing changes", remove that line.
contents = contents.replace(
`## ${UNRELEASED_PLACEHOLDER}\n\nNo user facing changes.`,
`## ${UNRELEASED_PLACEHOLDER}\n`,
);
export function getChangenote(cliVersion: string, prUrl: string): string {
// The GitHub Release for the new bundle version.
const bundleReleaseUrl = `${CLI_BUNDLE_RELEASE_URL_PREFIX}${cliVersion}`;

const changelog = parseChangelog(contents);

if (changelog.sections.length === 0) {
throw new Error("The changelog contains no existing sections.");
}

// Add the changelog note to the bottom of the first section.
const firstSection = changelog.sections[0];
const lastLine = firstSection.bodyLines.pop();

if (lastLine !== undefined && lastLine.trim() !== "") {
// We expect the last line to be empty. If it isn't for some reason,
// add it back.
firstSection.bodyLines.push(lastLine);
}

firstSection.bodyLines.push(changelogNote);

// If the last line is empty as expected, then add it back in after the new note.
if (lastLine?.trim() === "") {
firstSection.bodyLines.push(lastLine);
}

return renderChangelog(changelog);
const prNumber = getPRNumber(prUrl);
return `- Update default CodeQL bundle version to [${cliVersion}](${bundleReleaseUrl}). [#${prNumber}](${prUrl})\n`;
}

function main() {
try {
const cliVersion = getCLIVersion();
const prUrl = getPRUrl();

// The GitHub Release for the new bundle version.
const bundleReleaseUrl = `${CLI_BUNDLE_RELEASE_URL_PREFIX}${cliVersion}`;

// Get the PR number from the PR URL.
const prNumber = getPRNumber(prUrl);
const changelogNote = `- Update default CodeQL bundle version to [${cliVersion}](${bundleReleaseUrl}). [#${prNumber}](${prUrl})`;

let changelog = fs.readFileSync(CHANGELOG_FILE, "utf-8");

changelog = updateChangelog(changelog, changelogNote);

fs.writeFileSync(CHANGELOG_FILE, changelog);
// Include the CLI version in the file name so that changenotes for
// different bundle updates don't conflict.
const changenotePath = path.join(
CHANGENOTES_DIR,
`update-bundle-${cliVersion}.md`,
);
fs.writeFileSync(changenotePath, getChangenote(cliVersion, prUrl));

return 0;
} catch (err) {
console.error(`Failed to bundle changelog: ${getErrorMessage(err)}`);
console.error(
`Failed to create changenote for bundle update: ${getErrorMessage(err)}`,
);
return -1;
}
}
Expand Down
Loading