Skip to content

Convert sync_back.py to TypeScript#3529

Open
mbg wants to merge 11 commits intomainfrom
mbg/ts/sync-back
Open

Convert sync_back.py to TypeScript#3529
mbg wants to merge 11 commits intomainfrom
mbg/ts/sync-back

Conversation

@mbg
Copy link
Member

@mbg mbg commented Mar 1, 2026

Follow-up (and based on) #3526.

This PR converts sync_back.py and test_sync_back.py to TypeScript equivalents.

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?

  • Other - Please provide details.

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 1, 2026
@github-actions github-actions bot added the size/L May be hard to review label Mar 1, 2026
@mbg mbg marked this pull request as ready for review March 3, 2026 10:50
@mbg mbg requested a review from a team as a code owner March 3, 2026 10:50
Copilot AI review requested due to automatic review settings March 3, 2026 10:50
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 adds a TypeScript implementation of the sync_back utility used by PR checks tooling, and updates the rebuild workflow to use the new TS script when syncing Dependabot action-version updates back into the pr-checks sources.

Changes:

  • Add pr-checks/sync_back.ts to scan generated workflows and sync action versions back into pr-checks/sync.ts and pr-checks/checks/*.yml.
  • Add pr-checks/sync_back.test.ts with Node test coverage for the new TS implementation.
  • Update .github/workflows/rebuild.yml to run the new sync_back.ts via tsx during Dependabot rebuilds.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
pr-checks/sync_back.ts New TS sync-back implementation that updates template/action version references based on generated workflows.
pr-checks/sync_back.test.ts New Node tests for the TS sync-back implementation.
.github/workflows/rebuild.yml Switch rebuild workflow sync-back step from Python to npx tsx sync_back.ts.

Base automatically changed from mbg/pr-checks/ts to main March 3, 2026 11:06
@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 3, 2026
@esbena esbena self-requested a review March 3, 2026 11:48
Copy link
Contributor

@esbena esbena left a comment

Choose a reason for hiding this comment

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

Despite this being a migration of existing code, I do want a somewhat significant change. Could we take the various regular expression based parsing we have and move that into its own module? A file-internal dictionary is fine.

My main motivations for requesting this are:

  • I worry about redundant patterns currently.
  • I worry about too-specific patterns, where it is hard to see that they're wrong because they are placed in a very specific coding context.
  • They are general parsings that deserve their own very detailed JSDoc descriptions.


// Find all action uses in the file, including potential comments
// This pattern captures: action_name@version_with_possible_comment
const pattern = /uses:\s+([^/\s]+\/[^@\s]+)@([^@\n]+)/g;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please see the general comments about regex parsing, but as an example of that, this is one of three regex that uses the uses: prefix...

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.

3 participants