From 10fbc7feaaace990eb68453483c501a0c2cd18bd Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Tue, 29 Sep 2026 15:44:34 +0100 Subject: [PATCH 1/2] Revert "GHA-delete-GNU-workflow-logs.sh: Support custom jq command and support jaq for the case it is not installed as jq (#9581)" This reverts commit 3528d106e4b9930df9389eef2d91d41b8b9fb80e. --- util/GHA-delete-GNU-workflow-logs.sh | 31 ++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/util/GHA-delete-GNU-workflow-logs.sh b/util/GHA-delete-GNU-workflow-logs.sh index 95f5c240eb4..ebeb7cfe8f7 100755 --- a/util/GHA-delete-GNU-workflow-logs.sh +++ b/util/GHA-delete-GNU-workflow-logs.sh @@ -1,6 +1,6 @@ #!/bin/sh -# spell-checker:ignore (utils) gitsome jq jaq ; (gh) repos +# spell-checker:ignore (utils) gitsome jq ; (gh) repos # ME="${0}" # ME_dir="$(dirname -- "${ME}")" @@ -14,11 +14,24 @@ ## tools available? # * `gh` available? -GH=$(command -v gh) -"${GH}" --version || (echo "ERR!: missing \`gh\` (see install instructions at )"; exit 1) -# * `jq` or fallback available? -: ${JQ:=$(command -v jq || command -v jaq)} -"${JQ}" --version || (echo "ERR!: missing \`jq\` (install with \`sudo apt install jq\`)"; exit 1) +unset GH +if gh --version 1>/dev/null 2>&1; then + export GH="gh" +else + echo "ERR!: missing \`gh\` (see install instructions at )" 1>&2 +fi + +# * `jq` available? +unset JQ +if jq --version 1>/dev/null 2>&1; then + export JQ="jq" +else + echo "ERR!: missing \`jq\` (install with \`sudo apt install jq\`)" 1>&2 +fi + +if [ -z "${GH}" ] || [ -z "${JQ}" ]; then + exit 1 +fi case "${dry_run}" in '0' | 'f' | 'false' | 'no' | 'never' | 'none') unset dry_run ;; @@ -31,6 +44,6 @@ WORK_NAME="${WORK_NAME:-GNU}" # * `--paginate` retrieves all pages # gh api --paginate "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" | - "${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" | + 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 ;" _ From 1245cbdac6090e4a5deea6788744d8ab9b203aec Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Tue, 29 Sep 2026 16:19:07 +0100 Subject: [PATCH 2/2] refactor: use `gh api --jq` instead of `jq` --- util/GHA-delete-GNU-workflow-logs.sh | 29 ++++------------------------ 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/util/GHA-delete-GNU-workflow-logs.sh b/util/GHA-delete-GNU-workflow-logs.sh index ebeb7cfe8f7..de21de9d184 100755 --- a/util/GHA-delete-GNU-workflow-logs.sh +++ b/util/GHA-delete-GNU-workflow-logs.sh @@ -1,7 +1,5 @@ #!/bin/sh -# spell-checker:ignore (utils) gitsome jq ; (gh) repos - # ME="${0}" # ME_dir="$(dirname -- "${ME}")" # ME_parent_dir="$(dirname -- "${ME_dir}")" @@ -9,27 +7,8 @@ # ref: -# note: requires `gh` and `jq` - -## tools available? - -# * `gh` available? -unset GH -if gh --version 1>/dev/null 2>&1; then - export GH="gh" -else +if ! command -v gh >/dev/null 2>&1; then echo "ERR!: missing \`gh\` (see install instructions at )" 1>&2 -fi - -# * `jq` available? -unset JQ -if jq --version 1>/dev/null 2>&1; then - export JQ="jq" -else - echo "ERR!: missing \`jq\` (install with \`sudo apt install jq\`)" 1>&2 -fi - -if [ -z "${GH}" ] || [ -z "${JQ}" ]; then exit 1 fi @@ -43,7 +22,7 @@ REPO_NAME="${REPO_NAME:-coreutils}" WORK_NAME="${WORK_NAME:-GNU}" # * `--paginate` retrieves all pages -# gh api --paginate "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" | - jq -r ".workflow_runs[] | select(.name == \"${WORK_NAME}\") | (.id)" | +# gh api --paginate "repos/${USER_NAME}/${REPO_NAME}/actions/runs" --jq ".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" \ + --jq ".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 ;" _