# shellcheck shell=dash disable=SC2154
# https://docs.github.com/en/rest/releases/releases#delete-a-release
___x_cmd_gh_repo_release_rm() {
    param:scope  ___x_cmd_github
    param:dsl    '
options:
    #1           "Release ID"                            <>:number
    --repo|-r    "<owner_path>/<repo_path>"              <>:RepoName
    --yes|-y    "Ignore remove prompt interception"
'
    param:run
    ___x_cmd_gh_param_init_owner_repo

    [ "$yes" = "true" ] || ___x_cmd_ui_yesno "Are you sure you want to delete release $(___x_cmd_ui bold red "$1") on $owner_repo repo ?" || return
    ___x_cmd_gh_curl del "/repos/${owner_repo}/releases/${1}" | (
            [ -z "$___X_CMD_GH_IN_TEST" ] || { ___x_cmd_cmds_cat; return; }
            x jo env . gh_resp_msg=.message gh_resp_err=.errors
            if ___x_cmd_gh_http_error; then
                ___x_cmd_ui_tf  true "[Success]: Remove ${owner_repo} ${1} release"
            else
                ___x_cmd_ui_tf false "Remove ${owner_repo} ${1} release failure:" >&2
                ___x_cmd_gh____handle_resp
                return 1
            fi
        )
}