refactor: use gh api --jq instead of jq - #14963
Merged
Merged
Conversation
…d support jaq for the case it is not installed as jq (uutils#9581)" This reverts commit 3528d10.
Contributor
|
I did not test it. But fine for me. |
Collaborator
Author
|
I verified that: gh api "repos/uutils/coreutils/actions/runs" --jq ".workflow_runs[] | (.id)"has same output as: gh api "repos/uutils/coreutils/actions/runs" | jq -r ".workflow_runs[] | (.id)" |
sylvestre
reviewed
Sep 29, 2026
sylvestre
reviewed
Sep 29, 2026
sylvestre
reviewed
Sep 29, 2026
| "${GH}" api "repos/${USER_NAME}/${REPO_NAME}/actions/runs" | | ||
| "${JQ}" -r ".workflow_runs[] | select(.name == \"${WORK_NAME}\") | (.id)" | | ||
| xargs -n1 sh -c "for arg do { echo ${GH} api repos/${USER_NAME}/${REPO_NAME}/actions/runs/\${arg} -X DELETE ; if [ -z \"${dry_run}\" ]; then ${GH} api repos/${USER_NAME}/${REPO_NAME}/actions/runs/\${arg} -X DELETE ; fi ; } ; done ;" _ | ||
| gh api "repos/${USER_NAME}/${REPO_NAME}/actions/runs" \ |
Contributor
There was a problem hiding this comment.
could we add --paginate here while at it? it works fine with --jq and the comment above already talks about it
Collaborator
Author
There was a problem hiding this comment.
I'm not keen on refactoring this code, since I have no method to test.
Collaborator
Author
There was a problem hiding this comment.
It looks like the commented out code is the same thing as below, but without --paginate, so apparently --paginate was consciously removed at some point.
Collaborator
Author
Contributor
|
Thanks for your PR |
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.
Simplify
GHA-delete-GNU-workflow-logs.shby using the--jqoption provided bygh apiinstead of invoking the externaljqutility.This removes the separate
jqdependency and the associated availability check.Reverts #9581.
cc: @oech3