-
Notifications
You must be signed in to change notification settings - Fork 7
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
Make the query script simpler and more robust #3
Conversation
My motive behind this pull request is that sometime between 2021-07-01 and 2021-11-06, GitHub started to add |
585cbfc
to
fd10912
Compare
@generalmimon Thanks for the PR! I'll check it out this weekend. |
* Use `--get` instead of `-X GET`, as recommended in `curl` docs ( https://curl.se/docs/manpage.html#-X, https://curl.se/docs/manpage.html#-G ) * Set the HTTP header `Accept: application/vnd.github.v3+json`, as recommended throughout the GitHub REST API docs: https://docs.github.com/en/rest/reference/actions#list-jobs-for-a-workflow-run * Make the actual command simpler and more robust (avoids potential quoting issues, does not attempt to parse JSON output or the URL with `grep` or `sed` which is inherently unreliable and error-prone, etc.), using the approach from https://github.com/hashicorp/terraform-provider-external/blob/v2.2.0/website/docs/data_source.html.md#processing-json-in-shell-scripts * Double-quote all variables according to https://www.shellcheck.net/, see https://github.com/koalaman/shellcheck/wiki/SC2086 * Add newline at end of file
fd10912
to
95dc4bf
Compare
It's awesome! |
Thanks again for your contribution, @generalmimon. |
Make the query script simpler and more robust
--get
instead of-X GET
, as recommended incurl
docs( https://curl.se/docs/manpage.html#-X,
https://curl.se/docs/manpage.html#-G )
Accept: application/vnd.github.v3+json
, asrecommended throughout the GitHub REST API docs:
https://docs.github.com/en/rest/reference/actions#list-jobs-for-a-workflow-run
quoting issues, does not attempt to parse JSON output or the URL with
grep
orsed
which is inherently unreliable and error-prone, etc.),using the approach from
https://github.com/hashicorp/terraform-provider-external/blob/v2.2.0/website/docs/data_source.html.md#processing-json-in-shell-scripts
see https://github.com/koalaman/shellcheck/wiki/SC2086