-
Notifications
You must be signed in to change notification settings - Fork 433
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
Show resolved
Hide resolved
|
||||||
| 'gh release download --repo mikefarah/yq --pattern "yq_windows_amd64.exe" v4.50.1 -O "$YQ_PATH/yq.exe"\n' | |
| 'gh release download --repo mikefarah/yq --pattern "yq_windows_amd64.exe" "$YQ_VERSION" -O "$YQ_PATH/yq.exe"' |
I kind of agree with copilot.
Let's move the version out to a variable, and add and add an explanation and a direct link to the release as a comment.
Also, the trailing \n is confusing to read. Could we do something cleaner syntactically, or is this a workflow builder limitation?
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.
Let's move the version out to a variable, and add and add an explanation and a direct link to the release as a comment.
Sure, I can do that.
Also, the trailing
\nis confusing to read. Could we do something cleaner syntactically, or is this a workflow builder limitation?
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.
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).