-
Notifications
You must be signed in to change notification settings - Fork 451
Add installYq option to sync.py and install yq directly from GitHub release
#3423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||
| #!/usr/bin/env python | ||||||
|
|
||||||
| import ruamel.yaml | ||||||
| from ruamel.yaml.scalarstring import SingleQuotedScalarString | ||||||
| from ruamel.yaml.scalarstring import SingleQuotedScalarString, LiteralScalarString | ||||||
| import pathlib | ||||||
| import os | ||||||
|
|
||||||
|
|
@@ -223,6 +223,21 @@ def writeHeader(checkStream): | |||||
| } | ||||||
| }) | ||||||
|
|
||||||
| installYq = is_truthy(checkSpecification.get('installYq', '')) | ||||||
|
|
||||||
| if installYq: | ||||||
| steps.append({ | ||||||
| 'name': 'Install yq', | ||||||
| 'if': "runner.os == 'Windows'", | ||||||
| 'env': { | ||||||
| 'YQ_PATH': '${{ runner.temp }}/yq' | ||||||
| }, | ||||||
| 'run': LiteralScalarString( | ||||||
| 'gh release download --repo mikefarah/yq --pattern "yq_windows_amd64.exe" v4.50.1 -O "$YQ_PATH/yq.exe"\n' | ||||||
|
mbg marked this conversation as resolved.
Outdated
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I kind of agree with copilot. Also, the trailing
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sure, I can do that.
There might be something that's cleaner syntactically in Python, but this was the sanest option I came up with since Python multi-line strings mostly led to results with weird spacing. I am open to suggestions. |
||||||
| 'echo "$YQ_PATH" >> "$GITHUB_PATH"' | ||||||
| ), | ||||||
| }) | ||||||
|
|
||||||
| # If container initialisation steps are present in the check specification, | ||||||
| # make sure to execute them first. | ||||||
| if 'container' in checkSpecification and 'container-init-steps' in checkSpecification: | ||||||
|
|
||||||
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.
The directory
$YQ_PATHshould be created before downloading the file to ensure it exists. Consider addingmkdir -p "$YQ_PATH"as the first line of the run script to be consistent with similar patterns elsewhere in the codebase (e.g.,.github/workflows/__cleanup-db-cluster-dir.yml:60).