CodelyTV/pr-size-labeler

All labels were removed when jq parsing failed.

Opened this issue · 0 comments

info

It appears that all labels are removed when an unexpected json is returned from github.
I think it should be fail-safe in case of unexpected errors.

local -r body=$(curl -sSL -H "Authorization: token $GITHUB_TOKEN" -H "$GITHUB_API_HEADER" "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/pulls/$pr_number")
local labels=$(echo "$body" | jq .labels | jq -r ".[] | .name" | grep -w -e "$xs_label" -e "$s_label" -e "$m_label" -e "$l_label" -e "$xl_label" -v)

log

Labeling pull request with size/XL
jq: error (at <stdin>:1): Cannot iterate over null (null)
Final labels: "size/XL"
{
  "message": "Problems parsing JSON",
  "documentation_url": "https://docs.github.com/rest/issues/comments#create-an-issue-comment",
  "status": "400"
}


This repo is using Opire - what does it mean? 👇
💸Everyone can add rewards for this issue commenting /reward 100 (replace 100 with the amount)
💪 If someone starts working on this issue to earn the rewards, they can comment /try to let everyone know!
🙌 And when they open the PR, they can comment /claim #84 either in the PR description or in a PR's comment

👀 Also, everyone can tip any user commenting /tip 20 @mado-m (replace 20 with the amount, and @mado-m with the user to tip)

If you want to learn more, go to our documentation