Open
Conversation
These are needed to render them correctly in `sync_back.ts`
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors pr-checks/sync_back.ts to avoid regex-based workflow parsing by using the existing yaml library to parse generated workflows and update templates, and it factors Action version pinning into a dedicated action-versions.ts file consumed by sync.ts.
Changes:
- Parse
.github/workflows/__*.ymlwithyamlto extractuses:action refs (including inline comments) insync_back.ts. - Generate/update
pr-checks/action-versions.tsand updatesync.tsto reference it via a helper (getActionRef). - Update
pr-checks/checks/*.ymltemplates via YAML AST editing rather than regex substitution.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pr-checks/sync_back.ts | Switches to YAML AST traversal for scanning/updating and introduces writing action-versions.ts. |
| pr-checks/sync_back.test.ts | Updates tests to validate YAML-based scanning and the new action-versions.ts update behavior. |
| pr-checks/sync.ts | Loads action version pins from action-versions.ts instead of hardcoded refs. |
| pr-checks/action-versions.ts | New generated mapping of action names to pinned refs (and optional comments). |
| pr-checks/checks/overlay-init-fallback.yml | Template formatting change as a result of re-serialization. |
| pr-checks/checks/init-with-registries.yml | Template formatting change as a result of re-serialization. |
| pr-checks/checks/autobuild-direct-tracing-with-working-dir.yml | Template formatting change as a result of re-serialization. |
818a4b4 to
25599b3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an alternative to #3547 which avoids the regular expressions entirely. It does this by using the
yamllibrary that we already use insync.tsto:.github/workflowsto extract the action versionspr-checks/checksFor
sync.ts, I have extracted a mapping of action names to versions into a separate file (action-versions.ts) which can easily be re-generated by thesync_back.tsscript.A couple of extra notes for review:
eslintover the resultingaction-versions.tsfile, but this is currently sort-of blocked on me adding atsconfig.jsonforpr-checksand then aneslintconfig. I'll do that, but separately from this.Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Environments:
How did/will you validate this change?
.test.tsfiles).pr-checks).If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist