shields icon indicating copy to clipboard operation
shields copied to clipboard

Add issueUrl parameter to deprecatedService helper, test [GitHubWorkflowStatus]

Open PyvesB opened this issue 3 weeks ago • 1 comments

References: #11520 and https://github.com/badges/shields/pull/11524#discussion_r2561607224.

When trying to extend the existing deprecatedService helper, I bumped into the same issue described here: https://github.com/badges/shields/blob/93dcbf32ba3b795f69873cd16ad07e0fb6054707/services/github/github-workflow-status.service.js#L19-L24

The other thing that proved tricky was including a colour. It seemed useful to align on the red color used in GithubWorkflowStatus, but whatever is set in deprecatedService would be overwritten here: https://github.com/badges/shields/blob/93dcbf32ba3b795f69873cd16ad07e0fb6054707/core/base-service/base.js#L357

To work around this in a clean way, I decided to stop considering Deprecated as an error, and to perform normal badge rendering inside deprecatedService:

  • Philosophically speaking, I don't think rendering a deprecated badge is an error from the Shields.io perspective. It's a known route that we map to a static badge signalling to the user they should migrate the badge. Unlike other errors (NotFound, InvalidResponse, Inaccessible, ImproperlyConfigured, InvalidParameter), nothing unexpected has happened, both the user and upstream APIs behaved as usual.
  • Practically speaking, this gets rid of an exception as control flow anti-pattern, making the code easier to understand and more efficient.

PyvesB avatar Nov 30 '25 19:11 PyvesB

Messages
:book: :sparkles: Thanks for your contribution to Shields, @PyvesB!
:book:

Thanks for contributing to our documentation. We :heart: our documentarians!

Generated by :no_entry_sign: dangerJS against be7becb29a32284949ad7c9b0b8a61df60fcd87f

github-actions[bot] avatar Nov 30 '25 19:11 github-actions[bot]