Giter Club home page Giter Club logo

dynamic-badges-action's Introduction

Hi there πŸ‘‹

I am currently working at the University Bremen in close collaboration with the German Aerospace Center and the Bauhaus University Weimar.

In my spare time, I love creating open-source software! My current main project is πŸ₯§ Kando, a cross-platform pie menu. In addition, I am working on three extensions for GNOME Shell: πŸ₯§ Fly-Pie, πŸ”₯ Burn-My-Windows, and the 🧊 Desktop Cube.

My open-source projects are supported by these awesome people:

Sponsors List

dynamic-badges-action's People

Contributors

andries-smit avatar bhupesh-v avatar lucaswolfgang avatar lucberge avatar mishakav avatar runarberg avatar schneegans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dynamic-badges-action's Issues

How to use it with secret gists?

Hi,

I'm trying to use this with secret gist but I'm facing this issue.

Error: Failed to create gist, response status code: 404, status message: Not Found

I tried it with public gists and it works fine with public ones, so the issue is definitely not with the token. Is there something else that needs to be passed while using it with secret gist?

[BUG] Unauthorized

I followed Jared Wilcurt's article and Ned Batchelder's article on using dynamic-badges-action to make a code coverage badge.

I'm getting the following error when using your action:

Error: Failed to create gist, response status code: 401, status message: Unauthorized

I've created a secret token and gist, so I'm not sure why this is occurring. My repo is qtpygraph and you can see my latest GitHub Actions run here.

Could this possibly be due to a company firewall or anything of the sort?

Write SVG files to gist

There is no need to write a JSON to send as data to shields.io. Instead you can create the SVG icon directly in the gist by generating the icon with the same node library that shields.io publishes. Then the url path to the icon in your README becomes a lot easier:

![coverage badge](https://gist.github.com/<username>/<gistID>/filename.svg)

So I have a feature request: If the filename ends with .svg instead of .json we can generate the icon and post the SVG straight to the gist.

I have a proof of concept in a fork: https://github.com/runarberg/dynamic-badges-action

Storing json in wiki ?

Storing the JSON for shields.io in Gist is really smart, but this requires a few shenanigans.
Do you think it might be possible to store the json in a github wiki file?

Explanations

You can clone a repo's wiki (git clone [email protected]:owner/repo.wiki.git) and push files to it. Files pushed to a wiki are not visible in the repo's UI, but you can fetch them through the URL https://raw.githubusercontent.com/wiki/:owner/:repo/:file-path. This seems to work even if wiki is disabled for the project. (usually takes a few minutes for the URL to be updated but for the badges, I'd say it's usually not a problem, shields also does caching anyway)

Pros

  • You don't have to configure a gist. This makes the action much easier to configure
  • Also, you don't end up with multiple gists linked to repos around your gist account

Cons

  • You mess with the repo's wiki. Not that much that it might be problematic, I think, but still.
  • There's no web UI letting you inspect the json. I don't think it's an important part of the action
  • GitHub might change their way of doing. In the future, wiki URLs might become unavailable for repos that have disabled wikis. But it seems to work as of today.

Unknowns

Will the token provided in GitHub actions be enough to push on the wiki ? We'll have to test that.
It's possible that it still requires a PAT, but no gist. But the scope of the PAT might need to be bigger. Need to test this more.

Conclusion

If you think this is out of scope for this action, I'll probably try on my own (might be a fork of this action)

Cannot setup job on self hosted runner

Hello,

I am having an issue using the action on a self-hosted runner. The job has not even started it fails at the Set up job step:

Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'schneegans/dynamic-badges-action@e9a478b16159b4d31420099ba146cdc50f134483' (SHA:e9a478b16159b4d31420099ba146cdc50f134483)
Error: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter ''using: node20' is not supported, use 'docker', 'node12' or 'node16' instead.')
   at GitHub.Runner.Worker.ActionManifestManager.ConvertRuns(IExecutionContext executionContext, TemplateContext templateContext, TemplateToken inputsToken, String fileRelativePath, MappingToken outputs)
   at GitHub.Runner.Worker.ActionManifestManager.Load(IExecutionContext executionContext, String manifestFile)
Error: Fail to load schneegans\dynamic-badges-action\e9a478b16159b4d31420099ba146cdc50f134483\action.yml

I have node18 installed.

@Schneegans
Did you try to run the action on a self-hosted runner?
If yes, what node version?

Shield.io display domain is blocked

Hi! πŸ‘‹
First of all, thank you for this action that has been a very handy actions πŸ˜„

We have an issue with it, everything was working fine but two weeks ago the badge changed for:

badge

Maybe you have an idea?

Here is the gist generated

Thank you once again πŸ˜„

Fetching gist through github API fetches gist history

Currently it looks like when fetching a gist using the github API it also fetches the entire history for that gist.
This can be quite large depending on the gist lifetime.

Unfortunately the only way to fetch ONLY the gist in it's current state is with a GET request.

Action sometimes not outputting any results

Issue

Dynamic Badges Action sometimes does not create the gist.

Example

A workflow that I used that gave me this problem was this.

What I expected to happen

  1. Create 5 new gists for each of the Python versions with the message "Testing"
  2. Perform tests on each of the Python versions
  3. Overwrites the message of the previously create gists either with "Success" or "Fail' depending on the test result

What actually happened

  1. Only 2 new gists were created
  2. All the tests were performed
  3. Only 1 of the created gists was overwritten. 2 new gists was created. So I am left with 1 gist with the message "Testing" and am missing 1 more gist that I expected

Workflow outcome

Only the gists that were created showed a response output in the logs. The first image below will be the overall workflow progress. Everything checked out just fine. The subsection to this will show screenshots of the responses to Step 1, where only 2 steps produced a non-nil result.

2021-06-16-@18-49-21-scrot
Fig 1. Overall workflow result

Result of Job 1 of the workflow

After Job 1, only badges for Python 3.8 and 3.9 were displayed correctly.

Action producing no results

2021-06-16-@18-49-56-scrot
FIg 2. No result in logs for Python 2.7
2021-06-16-@18-50-27-scrot
Fig 3. No result in logs for Python 3.6
2021-06-16-@18-50-42-scrot
Fig 4. No result in logs for Python 3.7

Action producing results

2021-06-16-@18-51-07-scrot
Fig 5. Non-nil result in logs for Python 3.8
2021-06-16-@18-51-23-scrot
Fig 6. Non-nil result in logs for Python 3.9

Result on the README file

image
Fig 7. One gist is still missing and another has not been overwritten with the results of the tests

Discussion

I am not sure as to what might be the problem, but if I were to make a guess it would be that these processes might have been too rapidly executed, causing some unexpected hiccups.

Temporary solution

Only a few gists were not created, so it is possible for me to make use of the general idea to manually write gists for the badges with the corresponding `correct' values.

Gist by different user

Hi

Is it possible to specify the user of the gist? Let's say the gist is created by another user than the owner of the github repo?

upgrade for node 16

Hi!

Since a while, node12 is deprecated in git actions.

Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: schneegans/dynamic-badges-action

Can you please release a new version that fixes this?

See GitHub blogs about that.
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/

Thank you very much for this action.

"Bad credentials" bug

I'm triing to update a test file with this github action but I still getting an error.

Is there something wrong in my file ?

result when runing the actions

Run Schneegans/[email protected]
  with:
    gistID: 1db057b2a755ff6cfb841d987eeed3ab
    filename: test
    label: Test
    message: 98%
    color: green
result:{"message":"Bad credentials","documentation_url":"https://docs.github.com/rest"}

.yml action file

name: Update language value

on:
  push:
    branches:
    - "*"

jobs:
  updateValue:
    runs-on: ubuntu-latest
    steps:
    - name: Dynamic Badges
      uses: Schneegans/[email protected]
      with:
        auth: ${{ secrets.GIST_SECRET }}
        gistID: 1db057b2a755ff6cfb841d987eeed3ab
        filename: test
        label: Test
        message: 98%
        color: green

[FEATURE] Update gist only if changed

First of all thank you for the action, really useful.
It would be nice if you can add some property like update-if-changed: true (default may be false to keep backward compatibility).
The action will update the gist only if it doesn't exist or if it changed to reduce the amount of revisions, because usually the coverage of tests don't changes a lot, so in my case all the revisions looks like this:

image

Thank you

When using selft-hosted runner which set proxy, it will throw erros

erros:

Run schneegans/[email protected]
  with:
    gistID: 7495dccc42118020c12de5a095cfa2a6
    filename: nb-scala-build.json
    label: Time is 2022-08-[26](https://github.com/intel-analytics/BigDL/runs/8030396654?check_suite_focus=true#step:5:29)_05:46:03
    message: success
    color: red
  env:
    JAVA_HOME: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/8.0.342-7/x64
    TIME: 2022-08-26_05:46:03
    JOB-STATUS: success
    COLOR: red
events.js:291
      throw er; // Unhandled 'error' event
      ^

Error: connect ETIMEDOUT 140.82.114.5:443
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)
Emitted 'error' event on ClientRequest instance at:
    at TLSSocket.socketErrorListener (_http_client.js:4[27](https://github.com/intel-analytics/BigDL/runs/8030396654?check_suite_focus=true#step:5:30):9)
    at TLSSocket.emit (events.js:[31](https://github.com/intel-analytics/BigDL/runs/8030396654?check_suite_focus=true#step:5:34)4:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '1[40](https://github.com/intel-analytics/BigDL/runs/8030396654?check_suite_focus=true#step:5:44).82.114.5',
  port: 4[43](https://github.com/intel-analytics/BigDL/runs/8030396654?check_suite_focus=true#step:5:47)
}

How to use it with organizations accounts ?

Hello,

I just came accross this project and I was wondering how you would use it with an organization account ?

As I understand, you can't create gists with organizations accounts, so do you need to create a gist with a user account ?
Does that mean that the token will also have access to all the other user's gists ?
What if this user leaves the organization ?
Any advice would be appreciated :)

Can this be used for code coverage?

It looks like maybe? with the env usage, setting a environment variable to the coverage percent? but I'm not sure.

If it is possible, can you show an example in the README.

Preferably using Jest (most popular testing tool for JavaScript).

Thank you!

Thanks very much for this action, I've just started to use it for a small personal project and it's gratifying to have it. Cheers and best wishes!

Occasional "Gist not found 401" is the weakest link

Happens randomly and it's Github issue.
I know it's to much to ask to not use gist, but can we have at least few retries there?

2024-04-16T01:57:49.2801252Z ##[group]Run schneegans/[email protected]
2024-04-16T01:57:49.2801627Z with:
2024-04-16T01:57:49.2801874Z   gistID: xxxxxxxx
2024-04-16T01:57:49.2802239Z   filename: passing-tests-badge.json
2024-04-16T01:57:49.2802555Z   label: Tests
2024-04-16T01:57:49.2802792Z   message: 15 passed, 0 failed
2024-04-16T01:57:49.2803079Z   namedLogo: TestCafe
2024-04-16T01:57:49.2803331Z   labelColor: lightgrey
2024-04-16T01:57:49.2803595Z   color: brightgreen
2024-04-16T01:57:49.2803873Z   host: https://api.github.com/gists/
2024-04-16T01:57:49.2804189Z   forceUpdate: false
2024-04-16T01:57:49.2804426Z env:
2024-04-16T01:57:49.2804652Z   PUB_CACHE: /home/runner/.pub-cache
2024-04-16T01:57:49.2804957Z ##[endgroup]
2024-04-16T01:57:49.4689987Z ##[error]Failed to get gist: 401 Unauthorized

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.