Skip to content
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

All labels were removed when jq parsing failed. #84

Open
mado-m opened this issue Sep 17, 2024 · 0 comments
Open

All labels were removed when jq parsing failed. #84

mado-m opened this issue Sep 17, 2024 · 0 comments

Comments

@mado-m
Copy link

mado-m commented Sep 17, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant