diff --git a/util/GHA-delete-GNU-workflow-logs.sh b/util/GHA-delete-GNU-workflow-logs.sh index f7406b831..ebeb7cfe8 100755 --- a/util/GHA-delete-GNU-workflow-logs.sh +++ b/util/GHA-delete-GNU-workflow-logs.sh @@ -2,10 +2,10 @@ # spell-checker:ignore (utils) gitsome jq ; (gh) repos -ME="${0}" -ME_dir="$(dirname -- "${ME}")" -ME_parent_dir="$(dirname -- "${ME_dir}")" -ME_parent_dir_abs="$(realpath -mP -- "${ME_parent_dir}")" +# ME="${0}" +# ME_dir="$(dirname -- "${ME}")" +# ME_parent_dir="$(dirname -- "${ME_dir}")" +# ME_parent_dir_abs="$(realpath -mP -- "${ME_parent_dir}")" # ref: @@ -33,12 +33,17 @@ if [ -z "${GH}" ] || [ -z "${JQ}" ]; then exit 1 fi -dry_run=true +case "${dry_run}" in + '0' | 'f' | 'false' | 'no' | 'never' | 'none') unset dry_run ;; + *) dry_run="true" ;; +esac -USER_NAME=uutils -REPO_NAME=coreutils -WORK_NAME=GNU +USER_NAME="${USER_NAME:-uutils}" +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)" | 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 ;" _ diff --git a/util/build-code_coverage.sh b/util/build-code_coverage.sh index 083248d96..4082bc13d 100755 --- a/util/build-code_coverage.sh +++ b/util/build-code_coverage.sh @@ -8,7 +8,8 @@ FEATURES_OPTION="--features feat_os_unix" -ME_dir="$(dirname -- "$(readlink -fm -- "$0")")" +ME="${0}" +ME_dir="$(dirname -- "$(readlink -fm -- "${ME}")")" REPO_main_dir="$(dirname -- "${ME_dir}")" cd "${REPO_main_dir}" && diff --git a/util/show-code_coverage.sh b/util/show-code_coverage.sh index 4be056ccc..3f51462c9 100755 --- a/util/show-code_coverage.sh +++ b/util/show-code_coverage.sh @@ -2,7 +2,8 @@ # spell-checker:ignore (vars) OSID binfmt -ME_dir="$(dirname -- "$(readlink -fm -- "$0")")" +ME="${0}" +ME_dir="$(dirname -- "$(readlink -fm -- "${ME}")")" REPO_main_dir="$(dirname -- "${ME_dir}")" export COVERAGE_REPORT_DIR="${REPO_main_dir}/target/debug/coverage-nix"