mirror of
https://github.com/uutils/coreutils
synced 2024-11-10 07:04:16 +00:00
maint/refactor ~ (util) minor refactoring of util shell scripts
This commit is contained in:
parent
f477a41aee
commit
b7676c07e9
3 changed files with 18 additions and 11 deletions
|
@ -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: <https://stackoverflow.com/questions/57927115/anyone-know-a-way-to-delete-a-workflow-from-github-actions>
|
||||
|
||||
|
@ -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 ;" _
|
||||
|
|
|
@ -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}" &&
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue