Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
054745b
Convert `release-branches.py` to TypeScript
mbg Mar 13, 2026
aa27731
Install `node` in `release-initialise` action
mbg Mar 13, 2026
3db9a05
Replace `release-branches.py` with TS version in `release-branches` a…
mbg Mar 13, 2026
0d87a75
Refactor backport computation into `computeReleaseBranches`
mbg Mar 13, 2026
b72f4fe
Validate inputs
mbg Mar 13, 2026
49af37b
Add tests for `release-branches.ts`
mbg Mar 13, 2026
4867f59
Add config file for excluded checks from `update-required-checks.sh`
mbg Mar 13, 2026
9813849
Add initial TS implementation of `update-required-checks.sh`
mbg Mar 13, 2026
9481177
Initialise API client
mbg Mar 13, 2026
d2008ee
Add type to represent `exclusions.yml` and loading helper
mbg Mar 13, 2026
1bc611e
Fetch and filter check runs for `ref`
mbg Mar 13, 2026
a5244bf
Fetch release branches and identify major versions
mbg Mar 13, 2026
74dd691
Identify changes before applying them
mbg Mar 13, 2026
4cec5d2
Call `updateBranch` for `main`
mbg Mar 13, 2026
0543156
Actually perform the update when necessary and requested
mbg Mar 13, 2026
c5a984e
Update `CONTRIBUTING.md`
mbg Mar 13, 2026
9fe42f6
Add some unit tests for `sync-checks.ts`
mbg Mar 13, 2026
cfc1878
Rebuild
mbg Mar 16, 2026
75ed461
Add `excluded.yml` path to `config.ts`
mbg Mar 16, 2026
9fd40ff
Tidy up `pr-checks/package.json`
mbg Mar 16, 2026
07f235e
Add `--verbose` option
mbg Mar 16, 2026
0abe92e
Configure ESLint `import/no-extraneous-dependencies` rule for `pr-che…
mbg Mar 16, 2026
0da3139
Rename to `branchName`
mbg Mar 25, 2026
fa568eb
Delete `release-branches.py`
mbg Mar 25, 2026
e7c7b68
Remove `update-required-checks.sh`
mbg Mar 25, 2026
661a8fb
Default `ref` to `main`
mbg Mar 25, 2026
fae4c28
Update `CONTRIBUTING.md`
mbg Mar 25, 2026
a5418e1
Delete `releases.ini`
mbg Mar 25, 2026
8a0b4f2
fixup! Update `CONTRIBUTING.md`
mbg Mar 25, 2026
972365e
Fix comment
mbg Mar 25, 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
Next Next commit
Convert release-branches.py to TypeScript
  • Loading branch information
mbg committed Mar 25, 2026
commit 054745baee70380ac417ab0a61e1fc9df4940a53
1 change: 1 addition & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions pr-checks/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/** The oldest supported major version of the CodeQL Action. */
export const OLDEST_SUPPORTED_MAJOR_VERSION = 3;
1 change: 1 addition & 0 deletions pr-checks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"yaml": "^2.8.2"
},
"devDependencies": {
"@actions/core": "*",
"@types/node": "^20.19.9",
"tsx": "^4.21.0",
"typescript": "^5.9.3"
Expand Down
71 changes: 71 additions & 0 deletions pr-checks/release-branches.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env npx tsx

import { parseArgs } from "node:util";

import * as core from "@actions/core";

import { OLDEST_SUPPORTED_MAJOR_VERSION } from "./config";

async function main() {
const { values: options } = parseArgs({
options: {
// The major version of the release
"major-version": {
type: "string",
},
// The most recent tag published to the repository
"latest-tag": {
type: "string",
},
},
strict: true,
});

if (options["major-version"] === undefined) {
throw Error("--major-version is required");
}
if (options["latest-tag"] === undefined) {
throw Error("--latest-tag is required");
}

const majorVersion = Number.parseInt(options["major-version"].substring(1));
const latestTag = options["latest-tag"];

console.log(`major_version: v${majorVersion}`);
console.log(`latest_tag: ${latestTag}`);

// If this is a primary release, we backport to all supported branches,
// so we check whether the major_version taken from the package.json
// is greater than or equal to the latest tag pulled from the repo.
// For example...
// 'v1' >= 'v2' is False # we're operating from an older release branch and should not backport
// 'v2' >= 'v2' is True # the normal case where we're updating the current version
// 'v3' >= 'v2' is True # in this case we are making the first release of a new major version
const latestTagMajor = Number.parseInt(latestTag.split(".")[0].substring(1));
const considerBackports = majorVersion >= latestTagMajor;

core.setOutput("backport_source_branch", `releases/v${majorVersion}`);

const backportTargetBranches: string[] = [];

if (considerBackports) {
for (let i = latestTagMajor - 1; i > 0; i--) {
const branch_name = `releases/v${i}`;
if (i >= OLDEST_SUPPORTED_MAJOR_VERSION) {
backportTargetBranches.push(branch_name);
}
}
}

core.setOutput(
"backport_target_branches",
JSON.stringify(backportTargetBranches),
);

process.exit(0);
}

// Only call `main` if this script was run directly.
if (require.main === module) {
void main();
}