Skip to content

Convert release-branches.py and update-required-checks.sh to TypeScript#3575

Open
mbg wants to merge 30 commits intomainfrom
mbg/ts/sync-checks
Open

Convert release-branches.py and update-required-checks.sh to TypeScript#3575
mbg wants to merge 30 commits intomainfrom
mbg/ts/sync-checks

Conversation

@mbg
Copy link
Member

@mbg mbg commented Mar 16, 2026

Converts release-branches.py and update-required-checks.sh to TypeScript, similarly to what we have done for sync.py and sync_back.py recently.

Risk assessment

For internal use only. Please select the risk level of this change:

  • Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.

Which use cases does this change impact?

Environments:

  • Testing/None - This change does not impact any CodeQL workflows in production.

How did/will you validate this change?

  • Unit tests - I am depending on unit test coverage (i.e. tests in .test.ts files).
  • End-to-end tests - I am depending on PR checks (i.e. tests in pr-checks).

If something goes wrong after this change is released, what are the mitigation and rollback strategies?

  • Development/testing only - This change cannot cause any failures in production.

How will you know if something goes wrong after this change is released?

  • Other - Please provide details.

Are there any special considerations for merging or releasing this change?

  • No special considerations - This change can be merged at any time.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Consider adding a changelog entry for this change.
  • Confirm the readme and docs have been updated if necessary.

@mbg mbg self-assigned this Mar 16, 2026
@mbg mbg requested a review from a team as a code owner March 16, 2026 08:35
Copilot AI review requested due to automatic review settings March 16, 2026 08:35
@github-actions github-actions bot added the size/L May be hard to review label Mar 16, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates internal release/maintenance scripts from Python/Shell to TypeScript under pr-checks, aligning with the recent TS conversions in the same area of the repo.

Changes:

  • Add TypeScript equivalents for release-branch backport targeting and required-checks syncing (pr-checks/release-branches.ts, pr-checks/sync-checks.ts) plus unit tests.
  • Introduce shared config (pr-checks/config.ts) and an exclusions YAML for required-check filtering.
  • Update release composite actions and docs to invoke the new TS script and reference the new config location.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
pr-checks/sync-checks.ts New TS script to compute/apply required checks and exclude configured checks.
pr-checks/sync-checks.test.ts Unit tests for exclusion filtering logic.
pr-checks/release-branches.ts New TS script to compute backport source/target branches and set outputs.
pr-checks/release-branches.test.ts Unit tests for backport branch computation.
pr-checks/config.ts New constant for oldest supported major version used by TS scripts.
pr-checks/excluded.yml New configuration file for required-check exclusions.
pr-checks/package.json Add devDependencies needed for the new TS scripts.
package-lock.json Lockfile updates for the new pr-checks devDependencies.
CONTRIBUTING.md Documentation update to point to pr-checks/config.ts for OLDEST_SUPPORTED_MAJOR_VERSION.
.github/actions/release-initialise/action.yml Add Node setup to support running TS tooling during release workflows.
.github/actions/release-branches/action.yml Switch from Python script invocation to npx tsx running the TS script.
Comments suppressed due to low confidence (1)

pr-checks/sync-checks.test.ts:51

  • These assertions use Array.prototype.includes with freshly-created objects from toCheckInfo(...). Because includes checks referential equality for objects, these checks will always pass even if the item is present, making the test ineffective. Compare on a stable key (e.g., .some(c => c.context === ...)) or assert the retained contexts instead.
    assert.equal(retained.length, 2);
    assert.ok(!retained.includes(toCheckInfo("https://example.com")));
    assert.ok(!retained.includes(toCheckInfo("PR Check - Foo")));
  });

@mbg mbg force-pushed the mbg/ts/sync-checks branch from 957c182 to c9ad41d Compare March 16, 2026 09:55
@mbg mbg force-pushed the mbg/ts/sync-checks branch from 0d9bc07 to 0abe92e Compare March 25, 2026 13:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates internal release/PR-check maintenance scripts from Python/bash to TypeScript under pr-checks, and updates the release automation to run the new TS implementations.

Changes:

  • Added TypeScript implementations + unit tests for release-branch backport targeting and required-checks syncing logic.
  • Introduced shared pr-checks/config.ts and an excluded.yml config for filtering required checks.
  • Updated release composite actions and ESLint config to support running/linting the new pr-checks TypeScript code.

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
pr-checks/sync-checks.ts New TS script to compute/apply required checks from check-runs API + exclusions.
pr-checks/sync-checks.test.ts Unit tests for removeExcluded.
pr-checks/release-branches.ts New TS logic to compute backport source/targets for releases.
pr-checks/release-branches.test.ts Unit tests for computeBackportBranches.
pr-checks/package.json Adds dependencies needed to run the new TS scripts in the pr-checks workspace.
pr-checks/excluded.yml Centralized config of check names/patterns to exclude from required checks.
pr-checks/config.ts New shared config (including OLDEST_SUPPORTED_MAJOR_VERSION).
package-lock.json Lockfile updates for the added pr-checks dependencies.
eslint.config.mjs ESLint updates to correctly resolve workspace deps and lint pr-checks TS using its tsconfig.
CONTRIBUTING.md Documentation update pointing OLDEST_SUPPORTED_MAJOR_VERSION to pr-checks/config.ts.
.github/actions/release-initialise/action.yml Adds Node setup (Node 20 + npm cache) for release jobs.
.github/actions/release-branches/action.yml Switches release-branch computation from Python to the new TS script (runs npm ci + npx tsx).
lib/upload-sarif-action.js Generated bundle changes due to dependency graph adjustments.
lib/upload-sarif-action-post.js Generated bundle changes due to dependency graph adjustments.
lib/upload-lib.js Generated bundle changes due to dependency graph adjustments.
lib/start-proxy-action.js Generated bundle changes due to dependency graph adjustments.
lib/start-proxy-action-post.js Generated bundle changes due to dependency graph adjustments.
lib/setup-codeql-action.js Generated bundle changes due to dependency graph adjustments.
lib/resolve-environment-action.js Generated bundle changes due to dependency graph adjustments.
lib/init-action.js Generated bundle changes due to dependency graph adjustments.
lib/init-action-post.js Generated bundle changes due to dependency graph adjustments.
lib/autobuild-action.js Generated bundle changes due to dependency graph adjustments.
lib/analyze-action.js Generated bundle changes due to dependency graph adjustments.
lib/analyze-action-post.js Generated bundle changes due to dependency graph adjustments.

"@actions/core": "^2.0.3",
"@actions/github": "^8.0.1",
"@octokit/core": "^7.0.6",
"@octokit/plugin-paginate-rest": ">=9.2.2",
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@octokit/plugin-paginate-rest is specified with an open-ended version range (>=9.2.2), while the other dependencies use bounded ranges (e.g. ^x.y.z). Using >= can allow unintended major upgrades when regenerating the lockfile, which can break the scripts. Consider pinning to a bounded range (e.g. ^14.0.0) and rely on the root overrides/Dependabot for security bumps.

Suggested change
"@octokit/plugin-paginate-rest": ">=9.2.2",
"@octokit/plugin-paginate-rest": "^9.2.2",

Copilot uses AI. Check for mistakes.
@mbg mbg requested a review from Copilot March 25, 2026 13:50
@github-actions github-actions bot added size/XL May be very hard to review and removed size/L May be hard to review labels Mar 25, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 26 out of 27 changed files in this pull request and generated 5 comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL May be very hard to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants