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

Switch GitHub Workflow Status Badge to API #4587

Closed
calebcartwright opened this issue Jan 28, 2020 · 5 comments
Closed

Switch GitHub Workflow Status Badge to API #4587

calebcartwright opened this issue Jan 28, 2020 · 5 comments
Assignees
Labels
service-badge Accepted and actionable changes, features, and bugs

Comments

@calebcartwright
Copy link
Member

There's now GitHub Actions/Workflow specific APIs that are available, and we'll probably want to switch over to use them (we're currently svg scraping since APIs weren't readily available/limited when we first rolled out support)

Details on the v3 API linked below, though we should probably see if the v4 endpoints are available first.

https://developer.github.com/v3/actions/
#3898 (comment)

@calebcartwright calebcartwright added the service-badge Accepted and actionable changes, features, and bugs label Jan 28, 2020
@calebcartwright calebcartwright self-assigned this Mar 9, 2020
@calebcartwright
Copy link
Member Author

One of the things that's going to be interesting with this is that the Actions API only supports specifying the desired Workflow by id or by the yaml file name where the Workflow is defined

https://developer.github.com/v3/actions/workflow_runs/#list-workflow-runs

However.. our current Workflow Status badge (which is svg scraping the native badge because the API wasn't readily available back then) is based off a third identifier, the Workflow name.

On order to maintain BC for those existing badges, I see two paths forward:

  1. We could keep the svg scraping class that will maintain BC for workflow-name based badges, and create a new one that leverages the API and accepts the workflow file or id
  2. We maintain BC for workflow-name param by making an extra API call (list repository workflows) to extract the Workflow id, and then make the same API call.

Would there be any quota hit concerns with that second option? My sense is that we've got plenty of quota with the existing GH token pool, though I'm not sure if folks would have concerns with making multiple GH calls to render one badge

@vitr
Copy link

vitr commented Dec 19, 2020

Have you got any updates on this?
Please, correct me if I'm wrong, but without the switch, it's impossible to display private repo badges even on a self-hosted instance.

@simonhyll
Copy link

Ran into this issue while researching why my self hosted instance could create badges for things like commit activity but not for workflows. I assume this still isn't fixed.

What's the current issue that needs to be resolved? No one just hasn't bothered making it yet? Should I take a look at it?

On order to maintain BC for those existing badges, I see two paths forward:

Can't you just do it as 2 queries, one for a complete list of all workflows in the repo, then match against the workflow name to get the id? Or maybe add a flag to change the behavior from workflow name to workflow id / yaml file? Personally I'd prefer specifying the yaml file since the name can result in a more awkward looking url.

@chris48s
Copy link
Member

This is a useful bump in the context of:

We're looking at changing the current route anyway and switching to the yaml filename as the user supplied param anyway, so maybe that is the time to switch implementation too. I'll circle back to #8475 and have a look..

@chris48s
Copy link
Member

See #8671 for the details of the fix for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge Accepted and actionable changes, features, and bugs
Projects
None yet
Development

No branches or pull requests

4 participants