-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
GitHub issue detail state badge mislabels PRs as merged when using issues endpoint #11641
Copy link
Copy link
Closed
Labels
bugBugs in badges and the frontendBugs in badges and the frontendservice-badgeNew or updated service badgeNew or updated service badge
Description
Are you experiencing an issue with...
shields.io
🐞 Description
The badge path /github/issues/detail/state/:user/:repo/:number mislabels closed-but-unmerged PRs as merged.
GitHub’s issues API for PRs omits the top-level merged_at field, so the current logic
json.merged_at !== null evaluates true when the field is missing (undefined !== null).
This makes the badge render merged incorrectly.
🔗 Link to the badge
https://img.shields.io/github/issues/detail/state/go-vgo/robotgo/753?style=flat-square
💡 Possible Solution
When pull_request exists, use pull_request.merged_at to determine merge state.
Fallback to top-level merged_at if present. Treat null/undefined as not merged.
This fixes the misclassification without adding an extra API request.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugBugs in badges and the frontendBugs in badges and the frontendservice-badgeNew or updated service badgeNew or updated service badge