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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Badge request: GitHub actions #2574

Open
xiaoxiangmoe opened this issue Dec 22, 2018 · 30 comments

Comments

@xiaoxiangmoe
Copy link

commented Dec 22, 2018

馃搵 Description

badges for github actions

馃敆 Data

Being consulted, this is just an idea. No API available now.

https://developer.github.com/actions/

@paulmelnikow

This comment has been minimized.

Copy link
Member

commented Dec 23, 2018

Some questions for you:

  1. What's the problem you're wanting to solve?
  2. How do you want to use github actions to solve it?
  3. How would the badge be part of that?
@xiaoxiangmoe

This comment has been minimized.

Copy link
Author

commented Dec 24, 2018

  • Q: What's the problem you're wanting to solve?
    A: Badge for unit test status and coverages in github actions.
  • Q: How do you want to use github actions to solve it?
    A: I'll use github actions as runner for testing.
  • Q: How would the badge be part of that?
    A: Badge will show result of testing.
@devblackops

This comment has been minimized.

Copy link

commented Dec 30, 2018

Here is an example: https://github.com/CultureHQ/github-actions-badge

@paulmelnikow paulmelnikow changed the title Badge Request: Badges for github actions Badge request: GitHub actions Jan 25, 2019

@dougnukem

This comment has been minimized.

Copy link

commented Mar 12, 2019

@devblackops I'm using the badge from @kddeisz and it works great, they added functionality to link to github action results as well, maybe that can be added to shields.io (right now its a Lambda JS function).

Actions Status

@gr2m

This comment has been minimized.

Copy link

commented May 18, 2019

vintagesucks added a commit to vintagesucks/random-starred-repository that referenced this issue Aug 14, 2019
vintagesucks added a commit to vintagesucks/random-starred-repository that referenced this issue Aug 14, 2019
@imbsky

This comment has been minimized.

Copy link

commented Aug 18, 2019

+1

@chris48s

This comment has been minimized.

Copy link
Member

commented Aug 18, 2019

It looks like the other example posted is calling a URL like https://api.github.com/repos/badges/shields/commits/master/check-suites with the header Accept: application/vnd.github.antiope-preview+json, e.g:

curl -H "Accept: application/vnd.github.antiope-preview+json" https://api.github.com/repos/badges/shields/commits/master/check-suites

..and then looking for a check-suite with the name "GitHub Actions". GitHub's docs on this API call say

The API may change without advance notice during the preview period. Preview features are not supported for production use

( see https://developer.github.com/v3/checks/suites/#list-check-suites-for-a-specific-ref )

but tbh, if someone's interested in working on this, I'd be inclined to take a PR for it even though the API is beta at this stage.

@chris48s chris48s added good first issue and removed on-hold labels Aug 18, 2019

@qoomon

This comment has been minimized.

Copy link

commented Aug 19, 2019

FYI official badge api https://github.com/{github_id}/{repository}/workflows/{workflow_name}/badge.svg

@chris48s

This comment has been minimized.

Copy link
Member

commented Aug 19, 2019

official badge api

How interesting..

https://github.com/actions/toolkit/workflows/Main%20workflow/badge.svg

Do you have a link to the docs for that, or do you have to be in the actions beta to see them? I'd be interested to read more about this.

@qoomon

This comment has been minimized.

Copy link

commented Aug 19, 2019

@calebcartwright

This comment has been minimized.

Copy link
Member

commented Aug 19, 2019

I wonder if we went the SvgScraping route if we'd be able to avoid having to use tokens from the pool/hitting the throttling limits 馃

@khakiout

This comment has been minimized.

Copy link

commented Aug 23, 2019

FYI official badge api https://github.com/{github_id}/{repository}/workflows/{workflow_name}/badge.svg

Based on my testing, the workflow should be on the main branch for the badge to be generated. How about you?

@calebcartwright

This comment has been minimized.

Copy link
Member

commented Aug 25, 2019

@khakiout - I believe that is true based on what I've seen

@calebcartwright

This comment has been minimized.

Copy link
Member

commented Aug 25, 2019

I've opened #3898 and #3913 with two different implementations we could consider using. However, my takeaway from working on these is that any support we may potentially add for GitHub Actions to Shields in the short term would inevitably have some limitations and wouldn't be able to support certain edge cases.

At this moment GH Actions are still pretty new/beta, and there's just not a good official/well documented approach for Shields to get the GH Actions data, so we're stuck using the undocumented/unofficial or indirect approaches.

@calebcartwright

This comment has been minimized.

Copy link
Member

commented Aug 25, 2019

Also if anyone is using GitHub Actions in your repos and is willing to test...

Try out your repo/workflow in the staging apps:

@crazy-max

This comment has been minimized.

Copy link
Contributor

commented Aug 25, 2019

@calebcartwright Works fine for me on WindowsSpyBlocker 馃憣

GitHub Actions
GitHub Actions

@vintagesucks

This comment has been minimized.

Copy link

commented Aug 26, 2019

@calebcartwright Works fine for me, too. 馃憤

3898
3913

alexkli added a commit to adobe/wskdebug that referenced this issue Aug 26, 2019
fix github actions badge
adding github (official) new badge and shield.io preview one

see badges/shields#2574
@nemchik

This comment has been minimized.

Copy link

commented Aug 28, 2019

https://shields-staging-pr-3913.herokuapp.com (by branch/ref)

This is pretty much what shields already has for Travis-CI and GitLab pipeline which is what I came here for.

https://shields-staging-pr-3898.herokuapp.com (named workflow, master branch only)

This made me question things. Since I think you can have multiple workflows in any given branch I wonder which would be more useful. I imagine most people would come looking for branch/ref as it's closer to existing badges for other CI, but GitHub had to go and give us more features 馃槃

I wonder if they will expand the API to offer branch/ref? Surely they have a repo where an issue could be opened requesting the API add branch/ref so that we could maybe have both options?

P.s. I tested both staging apps and they both work for me.

fiedl added a commit to fiedl/hole-ice-install that referenced this issue Aug 28, 2019
@MaxUlysse MaxUlysse referenced this issue Aug 29, 2019
1 of 5 tasks complete
@knocte

This comment has been minimized.

Copy link

commented Aug 30, 2019

https://github.com/{github_id}/{repository}/workflows/{workflow_name}/badge.svg

Interestingly, in my case, I had to uppercase {workflow_name} (even if my yml file is lower case) for this pattern to work. HTH

EDIT: I'm wrong sorry! disregard this message :) (the workflow name is not the name of the .yml file, but the "name" value inside the .yml content.)

@Herohtar

This comment has been minimized.

Copy link

commented Sep 1, 2019

https://github.com/{github_id}/{repository}/workflows/{workflow_name}/badge.svg

Interestingly, in my case, I had to uppercase {workflow_name} (even if my yml file is lower case) for this pattern to work. HTH

That is incorrect; the {workflow_name} must match the case of your workflow's name. In your situation, your file was named ci.yml, but inside you had defined name: CI, which is why you had to use uppercase. The filename is only used if you do not specify name: in your YAML file.

@williamfzc

This comment has been minimized.

Copy link

commented Sep 2, 2019

Well done. If you have some spaces in your workflow name, just replace them with %20.

Python package -> Python%20package

But I have no idea if a '-' / '_' in it. Seems did not work.

@knocte

This comment has been minimized.

Copy link

commented Sep 2, 2019

That is incorrect

Confirmed, my bad. Thanks

vladak added a commit to vladak/photo-backup that referenced this issue Sep 9, 2019
@williamfzc

This comment has been minimized.

Copy link

commented Sep 10, 2019

@metaskills

This comment has been minimized.

Copy link

commented Sep 10, 2019

Beat me to it... noticed this last night too. Maybe they same my article where I mentioned this thread too. :P Thanks y'all. https://technology.customink.com/blog/2019/09/02/from-travis-ci-to-github-actions/

@calebcartwright

This comment has been minimized.

Copy link
Member

commented Sep 11, 2019

Awesome thanks for sharing that link @williamfzc (and good to have confirmation that it'll only work with the default branch)

@calebcartwright

This comment has been minimized.

Copy link
Member

commented Sep 11, 2019

Well done. If you have some spaces in your workflow name, just replace them with %20.

Python package -> Python%20package

But I have no idea if a '-' / '_' in it. Seems did not work.

Thanks for sharing. Do you have any examples that aren't working for you? We're proprly URL encoding the provided workflow name, so if you go to the reivew app and navigate to the Actions badge, you should be able to enter your workflow name directly. For example pasting in the example Main workflow text listed there

@calebcartwright

This comment has been minimized.

Copy link
Member

commented Sep 11, 2019

This made me question things. Since I think you can have multiple workflows in any given branch I wonder which would be more useful. I imagine most people would come looking for branch/ref as it's closer to existing badges for other CI, but GitHub had to go and give us more features 馃槃

I'm of two minds on this one as well, as I can certainly see value in both use cases.

I wonder if they will expand the API to offer branch/ref?

IMO the challenge that we have today, given that Actions is still in a beta mode, is that there isn't an API specifically for Actions/Workflows (at least not that we've been able to find anywhere). So at the moment we're stuck with using the Checks API which unsurprisingly does not have first class querying/filtering support on Actions specific constructs.

Surely they have a repo where an issue could be opened requesting the API add branch/ref so that we could maybe have both options?

I'm sure that once Actions is officially launched/comes out of beta that there will be an official API as well. It never hurts to ask in the interim, though I don't personally know what the best channel/repo would be to make that request

@calebcartwright

This comment has been minimized.

Copy link
Member

commented Sep 11, 2019

@badges/shields-maintainers - what are others thoughts on this? It seems that there's a lot of community interest in Shields providing some kind of support for GitHub Actions badges.

IMO we could provide our own alpha/beta support for GH Actions badges via #3898 or #3913, and then re-evaluate options/implementation in November once they generally release Actions

@hugovk

This comment has been minimized.

Copy link

commented Sep 12, 2019

I'm sure that once Actions is officially launched/comes out of beta that there will be an official API as well. It never hurts to ask in the interim, though I don't personally know what the best channel/repo would be to make that request

Try here, I requested a feature and they said they'd take a look:

@danielcompton

This comment has been minimized.

Copy link

commented Sep 15, 2019

For the lazy among us, the incantation you're probably looking for is:

[![Actions Status](https://github.com/{owner}/{repo}/workflows/{workflow_name}/badge.svg)](https://github.com/{owner}/{repo}/actions)

which I found at https://github.com/CultureHQ/github-actions-badge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can鈥檛 perform that action at this time.