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
Prev Previous commit
Next Next commit
Add some unit tests for sync-checks.ts
  • Loading branch information
mbg committed Mar 25, 2026
commit 9fe42f69b7de72555d6ce70549d2c2c762d3b197
49 changes: 49 additions & 0 deletions pr-checks/sync-checks.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env npx tsx

/*
Tests for the sync-checks.ts script
*/

import * as assert from "node:assert/strict";
import { describe, it } from "node:test";

import { CheckInfo, Exclusions, removeExcluded } from "./sync-checks";

const toCheckInfo = (name: string) =>
({ context: name, app_id: -1 }) satisfies CheckInfo;

const expectedPartialMatches = ["PR Check - Foo", "https://example.com"].map(
toCheckInfo,
);

const expectedExactMatches = ["CodeQL", "Update"].map(toCheckInfo);

const testChecks = expectedExactMatches.concat(expectedPartialMatches);

const emptyExclusions: Exclusions = {
is: [],
contains: [],
};

describe("removeExcluded", async () => {
await it("retains all checks if no exclusions are configured", () => {
const retained = removeExcluded(emptyExclusions, testChecks);
assert.deepEqual(retained, testChecks);
});

await it("removes exact matches", () => {
const retained = removeExcluded(
{ ...emptyExclusions, is: ["CodeQL", "Update"] },
testChecks,
);
assert.deepEqual(retained, expectedPartialMatches);
});

await it("removes partial matches", () => {
const retained = removeExcluded(
{ ...emptyExclusions, contains: ["https://", "PR Check"] },
testChecks,
);
assert.deepEqual(retained, expectedExactMatches);
});
});
4 changes: 2 additions & 2 deletions pr-checks/sync-checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const codeqlActionRepo = {
};

/** Represents a configuration of which checks should not be set up as required checks. */
interface Exclusions {
export interface Exclusions {
/** A list of strings that, if contained in a check name, are excluded. */
contains: string[];
/** A list of check names that are excluded if their name is an exact match. */
Expand All @@ -55,7 +55,7 @@ function getApiClient(token: string): ApiClient {
* Represents information about a check run. We track the `app_id` that generated the check,
* because the API will require it in addition to the name in the future.
*/
interface CheckInfo {
export interface CheckInfo {
/** The display name of the check. */
context: string;
/** The ID of the app that generated the check. */
Expand Down