Skip to content

Commit

Permalink
correctly handle 404 on PR lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
smmckay authored and drewdeponte committed Aug 22, 2024
1 parent a440e2a commit 8b02129
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions example_hooks/request_review_post_sync.sample.gitlab-cli
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ if ! glab auth status >/dev/null 2>&1; then
exit 1
fi

state=$(glab mr -R "$patch_stack_upstream_remote_url" view $patch_upstream_branch_name -F json | jq -r .state)
state_json=$(glab mr -R "$patch_stack_upstream_remote_url" view $patch_upstream_branch_name -F json 2>/dev/null)
if [ $? -eq 0 ]; then
if [ $state = "opened" ]; then
state=$(echo "$state_json" | jq -r .state)
if [ "$state" = "opened" ]; then
echo "Open PR already exists, updating description"
action="update_description"
else
Expand Down

0 comments on commit 8b02129

Please sign in to comment.