From 870862ed0814a571c54988fd6de7abdd1419b2c8 Mon Sep 17 00:00:00 2001 From: Abdalaziz Mohamed Date: Thu, 18 Apr 2024 09:11:46 +0200 Subject: [PATCH] ci: exit on error in gh command --- scripts/gh-utils.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/gh-utils.sh b/scripts/gh-utils.sh index a0adcd8..21650a8 100644 --- a/scripts/gh-utils.sh +++ b/scripts/gh-utils.sh @@ -13,7 +13,7 @@ function delete_previous_comments() { _nextPage="1" while [[ "${_nextPage}" != "0" ]]; do - _comments="$(gh api "/repos/${_repo_org}/${_repo_name}/issues/${_pr_number}/comments?direction=asc&per_page=20&page=${_nextPage}")" + _comments="$(gh api "/repos/${_repo_org}/${_repo_name}/issues/${_pr_number}/comments?direction=asc&per_page=20&page=${_nextPage}")" || exit 1 if [[ "$(echo "${_comments}" | jq '.|length')" == 0 ]]; then _nextPage="0" else @@ -22,7 +22,7 @@ function delete_previous_comments() { while read -r _previous_comment_id; do log_out "Deleting previous comment with ID: ${_previous_comment_id}" gh api "/repos/${_repo_org}/${_repo_name}/issues/comments/${_previous_comment_id}" -X DELETE >/dev/null - done < <(echo "${_comments}" | jq ".[] | select(.body|startswith(\"$(get_formatted_comment_id "${_comment_id}")\")) | .id") + done < <(echo "${_comments}" | jq ".[] | select(.body|startswith(\"$(get_formatted_comment_id "${_comment_id}")\")) | .id") || exit 1 done }