Skip to content

fix: give existing score labels their band colour - #18

Merged
ngoyal16 merged 1 commit into
mainfrom
fix/score-label-colors
Nov 23, 2026
Merged

ngoyal16 merged 1 commit into
mainfrom
fix/score-label-colors

Conversation

@ngoyal16

Copy link
Copy Markdown
Contributor

Problem

Score labels in the green band didn't show green on the MR, while red and orange looked right.

The colours in the code have always been right: green 2da44e, orange fb8c00, red d73a49. But SetScoreLabels only creates a label. When it already exists (GitLab 409, GitHub 422), it's kept as it is, so a Quality Score::85 made earlier in another colour (by hand, by an earlier tool, or GitLab's default) never turns green.

Fix

When the label already exists, read its colour and update it to the band colour if it differs:

  • GitLab: GET and PUT /projects/:id/labels/:name. Only project labels are changed. A group label of the same name can't be changed from the project, so it's left as it is; change its colour or delete it in the group.
  • GitHub: GET and PATCH /repos/:o/:r/labels/:name.

This is best effort: a failed recolour leaves the label and doesn't fail the review. A score label's name fixes its value and so its band, so recolouring is safe.

Tests

go test ./... passes. The label tests now cover a GitLab label made earlier in #6699cc, which is recoloured to #2da44e, and a GitHub label already green in a different case, which is left alone, next to one in ededed, which is recoloured.

🤖 Generated with Claude Code

Score labels were created with the band colour (green 2da44e, orange
fb8c00, red d73a49), but a label that already existed was left as it
was, so a score label made earlier in another colour (by hand, by
another tool) kept that colour. An existing score label is now
recoloured to its band, on GitLab (project labels; a group label can't
be changed from the project) and GitHub. Best effort: a failure leaves
the label and doesn't fail the review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ngoyal16
ngoyal16 merged commit 1d97934 into main Nov 23, 2026
12 checks passed
@ngoyal16
ngoyal16 deleted the fix/score-label-colors branch November 23, 2026 14:01
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

Successfully merging this pull request may close these issues.

1 participant