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

Not valid Github status badge for broken workflow #8146

Closed
dmvict opened this issue Jul 1, 2022 · 13 comments
Closed

Not valid Github status badge for broken workflow #8146

dmvict opened this issue Jul 1, 2022 · 13 comments
Labels
needs-upstream-help Not actionable without help from a service provider question Support questions, usage questions, unconfirmed bugs, discussions, ideas service-badge New or updated service badge

Comments

@dmvict
Copy link

dmvict commented Jul 1, 2022

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

@dmvict dmvict added the question Support questions, usage questions, unconfirmed bugs, discussions, ideas label Jul 1, 2022
@dmvict dmvict changed the title Not valid status badge for broken workflow on Github Not valid Github status badge for broken workflow Jul 1, 2022
@chris48s
Copy link
Member

chris48s commented Jul 1, 2022

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.

@chris48s chris48s added service-badge New or updated service badge labels Jul 1, 2022
@dmvict
Copy link
Author

dmvict commented Jul 1, 2022

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.

@calebcartwright
Copy link
Member

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 calebcartwright added the needs-upstream-help Not actionable without help from a service provider label Jul 1, 2022
@exoRift
Copy link

exoRift commented Aug 14, 2022

@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

@calebcartwright
Copy link
Member

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

@chris48s
Copy link
Member

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.

@calebcartwright
Copy link
Member

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

@renanrcp
Copy link

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

@chris48s
Copy link
Member

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.

@chris48s
Copy link
Member

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

@chris48s
Copy link
Member

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.

@chris48s
Copy link
Member

See #8671 for the details of the fix for this

@ghost
Copy link

ghost commented Jan 23, 2023

هل تواجه مشكلة مع ...

الدروع

🐞وصف

لقد لاحظت أن shields.ioتقديم شارة الحالة passingلسير العمل المعطل

صورة

النتائج الحقيقية هي:

صورة

الارتباط إلى سير العمل يعمل على لقطة الشاشة. المستودع حيث يتم استخدام شارات حالة shields.io.

تعمل الشارة بشكل جيد مع ملفات سير العمل الصالحة. وقد تم إصلاح سير العمل هذا الآن. من فضلك ، حاول إعادة إنتاج وإصلاح الخطأ.

🔗رابط للشارة

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

💡حل ممكن

لا يوجد رد

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-upstream-help Not actionable without help from a service provider question Support questions, usage questions, unconfirmed bugs, discussions, ideas service-badge New or updated service badge
Projects
None yet
Development

No branches or pull requests

5 participants