Skip to content

CI: Continue even with GitHub comment error #933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions scripts/ci/jobs/push-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,32 @@ push_images() {
push_image_set

if is_in_PR_context; then
comment_on_pr
comment_on_pr || {
warn "Could not add a comment to the PR"
}
fi
}

comment_on_pr() {
info "Adding a comment with the build tag to the PR"

local pr_details
local exitstatus=0
pr_details="$(get_pr_details)" || exitstatus="$?"
if [[ "$exitstatus" != "0" ]]; then
debug "Unable to get the PR details from GitHub: $exitstatus"
debug "PR details: ${pr_details}"
info "Will continue without commenting on the PR"
return
fi

# hub-comment is tied to Circle CI env
local url
url=$(get_pr_details | jq -r '.html_url')
url=$(jq -r '.html_url' <<<"$pr_details")
export CIRCLE_PULL_REQUEST="$url"

local sha
sha=$(get_pr_details | jq -r '.head.sha')
sha=$(jq -r '.head.sha' <<<"$pr_details")
sha=${sha:0:7}
export _SHA="$sha"

Expand Down
4 changes: 4 additions & 0 deletions scripts/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ error() {
echo "ERROR: $(date): $*"
}

debug() {
echo "DEBUG: $(date): $*"
}

die() {
echo >&2 "$@"
exit 1
Expand Down