GeezerVison is showing github.com — Parse and generate YAML in `sync_back.ts` by mbg · Pull Request #3556 · github/codeql-action
Conversation
mbg
commented
Mar 7, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
This is an alternative to #3547 which avoids the regular expressions entirely. It does this by using the yaml library that we already use in sync.ts to:
- Parse the workflows in
.github/workflows to extract the action versions
- Then parses, updates, and renders the workflow templates in
pr-checks/checks
For 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 the sync_back.ts script.
A couple of extra notes for review:
- I looked into running
eslint over the resulting action-versions.ts file, but this is currently sort-of blocked on me adding a tsconfig.json for pr-checks and then an eslint config. I'll do that, but separately from this.
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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
These are needed to render them correctly in `sync_back.ts`
There was a problem hiding this 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 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/__*.yml with yaml to extract uses: action refs (including inline comments) in sync_back.ts.
- Generate/update
pr-checks/action-versions.ts and update sync.ts to reference it via a helper (getActionRef).
- Update
pr-checks/checks/*.yml templates 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. |
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this approach. Thanks for this extra follow-up effort.
In addition to the yaml traversal comment, I have one comment that we'll discuss internally.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+63
to
+64
|
|
pair.key.value === "uses" &&
|
|
|
typeof pair.value.value === "string"
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the idea of this visitor is to recursively visit everything in the YAML document and then for any uses: <string> cases do something?
My worry is that this could hit too many things. Concretely a user could have env: uses: "foo"
I would prefer a setup where we specifically target the individual steps in a more semantic manner:
We know the exact object depth at which these step definitions can occur, both for workflow files and composite actions...
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
pull Bot
pushed a commit
to Stars1233/codeql-action
that referenced
this pull request
Jun 3, 2026
This is intended as a workaround until github#3556 is merged.
This branch has not been deployed
No deployments
Reviewers
esbena
esbena left review comments
At least 1 approving review is required to merge this pull request.
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|