badges / shields

Concise, consistent, and legible badges in SVG and raster format

Home Page:https://shields.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not valid Github status badge for broken workflow

dmvict opened this issue Β· comments

Are you experiencing an issue with...

shields.io

🐞 Description

I noticed that shields.io provide status badge passing for broken workflow

image

The real results is :

image

The link to the workflow run on the screenshot. Repository where shields.io status badges are used.

The badge works well with valid workflow files. And this workflow is fixed now. Please, try to reproduce and fix the bug.

πŸ”— Link to the badge

https://img.shields.io/github/workflow/status/Wandalen/wTools/mod_interface?label=

πŸ’‘ Possible Solution

No response

Our badges for github workflows are basically just "scrapers" for github's own badges so when you call https://img.shields.io/github/workflow/status/Wandalen/wTools/mod_interface/alpha it calls https://github.com/Wandalen/wTools/workflows/mod_interface/badge.svg?branch=alpha and then reports the value from that. It is essentially just a "wrapper" that allows you to use the full range of shields styles. Looks like your builds are now fixed so I now can't reproduce it but if you can break one again, check the actual github badges and see what value you've got.

I missed this screenshot in the issue description
image

The screenshot was maiden just before the issue was opened. So, the bug exists, and the working case for the bug is a broken workflow.

If I will have time to test this scenario, then I will report the results.
I will close the issue after approval of the correct badge work for the described case.

Unfortunately I suspect this is reflective of some upstream changes GitHub have rolled out, relative to #7102

Here's what GitHub shows for some of your branches (screen grab at the bottom in case statuses change)
https://github.com/Wandalen/wTools/actions/workflows/ModuleModInterfacePush.yml/badge.svg?branch=master

https://github.com/Wandalen/wTools/workflows/mod_interface/badge.svg?branch=master

It looks like GitHub updated the docs back in https://github.com/github/docs/pull/3802/files#diff-95d58394efa588c4f92f85274259efb8ca1e10a02bd346549e65b57604c156c4. However, I think that there's either a new(ish) issue in the original, by-name endpoint, or that GitHub have just recently rolled out the changes.

As Chris noted we rely on the upstream providers to deliver information, which is what we then use. In this case the endpoint that we've always used for Workflow Status is claiming your master branch is passing, so that's what is being displayed.

I think this is something that needs to be tracked down with GitHub to get a definitive answer. We can't simply "just switch" to the workflow file name model either as that would break our existing users which is not something we want to do if GitHub plan to fix the by-name endpoint.

image

@calebcartwright What if we have it fetch legacy first and if it's a 404, fetch the new URL? (And an alternative to not use legacy at all for those with existing legacies that are now static)

Say the word and I'll put it in my existing PR

That's an interesting idea @exoRift. I think I could get behind that as a tactical solution (since the badges currently appear to be broken for half the audience), so long as we keep tracking towards something more long term.

@chris48s would you have any concerns with this? I feel like it should be simple enough at the code level, and not like it would have any tangible impact on our token pool nor the traffic volume we throw github's way

So if we think

https://github.com/exoRift/react-fluent-mobile/workflows/Quality%20Assurance/badge.svg?branch=master is returning inaccurate or out-of-date info

and

https://github.com/exoRift/react-fluent-mobile/actions/workflows/quality_assurance.yml/badge.svg?branch=master is correct,

I think trying to serve information we believe is wrong or outdated first is the wrong call. I think there are really 2 sensible things we can do:

Option 1:

  • Create a new badge route that accepts the workflow file name as the param and call /actions/workflows/<WORKFLOW_FILE> to get the data
  • Retire/deprecate our existing route, stop serving data and show some kind of error message advising users to switch

Option 2:

Overload the existing route to take a generic :param which could be a workflow filename or name, but do it the other way round:

  • Try to call /actions/workflows/<param> first
  • Fall back to /workflows/<param> second

Option 2 has the advantage that all the existing badges out there in the wild will still "work", but if we think they are serving stale/inaccurate data then this is not necessarily much of an "advantage". I think serving an error saying "you need update your badge URL" is ultimately more useful then "here's a value that might not be right"

I guess the thing I'd like to be slightly more sure of is: what is the status of the /workflows/<WORKFLOW_NAME> endpoint we are currently using? It is certainly still returning some data. Beyond anec-data: The commit where this changed in the GitHub docs is github/docs@f9b50ac but it has no useful info in the commit message and the linked issue is a 404 so the trail goes cold there.

I think trying to serve information we believe is wrong or outdated first is the wrong call.

Good point. I'd already forgotten that the two endpoints need different inputs

I guess the thing I'd like to be slightly more sure of is: what is the status of the /workflows/<WORKFLOW_NAME> endpoint we are currently using? It is certainly still returning some data. Beyond anec-data: The commit where this changed in the GitHub docs is github/docs@f9b50ac but it has no useful info in the commit message and the linked issue is a 404 so the trail goes cold there.

Yup, I'd found that too and expressed some of the same thinking earlier in the thread. It's an odd scenario and I'm not sure the best way to get in touch with GitHub for a definitive answer on this particular item. Guess we can try the user forum

I have a proposal for this issue:

  • Add the (legacy) suffix in the name of all the current Github badges with the old path.
  • Create new badges and new endpoints for the newer Github path, eg. the old path is /github/workflow/status/:user/:repo/:workflow the new can be /github/actions/workflow/status/:user/:repo/:workflowFileName

Images example:

Current behavior:

image

Proposed new behavior:

image

I am willing to do the PR too if this proposal eventually is approved πŸ˜‰

For now, I've created a Vercel app that uses the json badge for any people with this problem:
Example for my repo NextAudio

Shields.io badge:


App badge (using Shields.io json option):


App Repo
App Url

Tbh, I'd rather just deprecate it rather than keep around a a "legacy" version if we can't rely on the data.

I've started a discussion over at https://github.com/orgs/community/discussions/33739 to try and get an answer. If we don't get to the bottom of it there, I'll try contacting support.

Nobody replied to https://github.com/orgs/community/discussions/33739
I've now raised a ticket with github support

I got this message back from support, which is quite helpful and does explain what is happening:

Thank you for your patience while we investigated this.

I have been updated that the file name route is the recommended route and therefore the only one we currently document. The old badge route had some issues disambiguating between workflows with the same name, handling renames, etc. We no longer document that format.

Looking at the first example :

I think my conclusion from this is that we should:

  • Create a new badge route that accepts the workflow file name as the param and call /actions/workflows/<WORKFLOW_FILE> to get the data
  • Deprecate our existing route instead of keeping it around, given it has some known spurious behaviours

I'll submit a PR doing this next week (I'm going to be away for a few days), unless someone wants to jump on it over the weekend.