I have a GitHub action workflow that outputs a number and I want to display that in a badge.
Using https://github.com/username/reponame/actions/workflows/myaction.yml/badge.svg I get a red or green failing/success badge but I want to display the number of failures instead, which the workflow outputs into the "errors" output variable.
How can I access that variable in a badge?
There are few options in Github actions marketplace
Bring Your Own Badge - https://github.com/marketplace/actions/bring-your-own-badge
BYOB is a GitHub Action to create badges dynamically based off of GitHub Actions' results, allowing for extremely versatile and easily-maintainable badges.
If you want to use https://shields.io/, consider Dynamic Badges - https://github.com/marketplace/actions/dynamic-badges
This action allows you to create badges for your README.md with shields.io which may change with every commit. To do this, this action does not need to push anything to your repository!
In a subsequent job (step) in the same workflow you could.
I think you want to use your own badge using e.g. https://img.shields.io.
I image you will update e.g. the README file every time the actions are finished, the updating step will be part of the workflow. The transfer of output could be done like here Using output from a previous job in a new one in a GitHub Action.
You will append e.g. the README with a proper svg [![](https://img.shields.io/badge/TEXT-NUMBER-COLOR?style=flat)](some url).
I created an action to generate a badge from a workflow:
Build-A-Badge - https://github.com/marketplace/actions/build-a-badge
As other users have pointed out, I didn't want any external dependencies or to create new branches on the main repo. So the workaround I used is to store the badge data in the Wiki, which is a separate repository.
Related
We have a workflow that runs whenever a tag with a specific format is pushed to the main repository. Originally, the displayed name is consistent with the name: entry at the beginning of the workflow file, but this is no longer the case.
Before this change, we had a separate repository with a cron workflow that ran a python script to push the tag to the main repository, which triggers the workflow there.
We recently moved to using a workflow from the main repository to push the tag, and this is when the different workflow display name changed. There are some differences between the two triggering workflows. The old trigger ran a python script which presumably pushed the tags "from" the script. The new trigger explicitly calls git push --tags from the workflow file itself.
I believe the move to the new trigger is why the display name is changed, but I cannot be certain.
I'm new to GitHub's template repositories. We've created a template repo for our course's code labs. Let's say it's on GitHub under myorg/labX. The students are using GitHub Classroom, which clones the template repo for each student under myorg/labX-studentlogin. We've got actions to run some tests against their code using GitHub's own CI, and I want to include badges in the repo's README.md to see the test results at a glance. So I know that
![](https://github.com/myorg/labX/workflows/task1/badge.svg)
will include the badge, but this is the status of the template repo, not student repos. Is there a way to automate this so that when the students get their clone, it will contain a README with the URL that refers to the status of their own repo?
Turns out there is a simple solution, but only for GitHub's own Actions status badges. We've changed the image URL in our README.mds to relative.
The only minor thing is GitHub will insert /blob/<branch>/ into relative links when rendering the readmes.
For example, workflows/task1/badge.svg will become https://github.com/myorg/labX/blob/master/workflows/task1/badge.svg), which won't render. So we had to prepend '../../' to fool it.
TLDR: in repo's README.md, use
![](../../workflows/<workflowname>/badge.svg)
to get a badge for an Action status in this repo. This way, each student will get a badge referring to his own repo, not the template repo.
However, still looking for a way to use an external badge service like shields.io in a way relative to the repo.
I agree it would be a great feature to have.
It looks like at this point, GitHub Template Repositories do not support variable substitution, which is what would make it possible.
I see it is discussed briefly here:
Variable substitution for GitHub Template Repository Usage
Perhaps you should join the discussion and/or cast your Kudo.
Is it possible to get serialized output of some sort from the /dashboard/projects screen in GitLab?
(I want to track differences and alert myself when someone assigns me a new project. One option is of course to build a script that iterates through the HTML pages, but if there's a way to get all projects at once -- preferably in a machine-friendly format -- that's even better.)
I think that usually this kind of alert are not strictly needed, because usually the assignment workflow is about issue/MR assignment (which usually end up in a email in you inbox), anyway..
You should take a look at GitLab API or, even better, use an already existing project like Python GitLab
It is a Python client implementation of GitLab API and also have an handy gitlab command line tool that can give you the required data in a human/machine readable format
I'm using Jenkins 1.554.3 and specifying conditional action for Flexible publish as a post build step.
Looking on the list of available actions I can see that it contains only post-build steps.
How I can update this list with the list with the actions available from build steps and specify as action for Flexibly publish post build step?
Thank you.
Use Jenkins Any Build Step plugin. It allows to use Publishers (post-build actions) as Build Steps and vice-versa.
Then, under Jenkins Global Configuration, there is a Flexible Publish section. Set the value to Any build step. This will allow build steps under post-build actions.
For the sake of completeness, to allow post-build action under build steps, there is a section Conditional buildstep. Set the value there to Any build step too.
Our build has a variety of generated HTML reports. I would like to have those reported and accessible on the build page, like JavaDoc entries. Is there a generic way to expose these reports without writing a custom plug ins ?
If that isn't available, is there a way to post an HTTP link on the page ?
You can choose "archive the artifacts" and archive for example "reports/*.html"
These will appear under the project page under the heading "Last successful artifacts".
Even if you clear your workspace before each build, these artifacts are moved to a separate directory.
You could also add a build script which will modify or update a file in your userContent directory (since Hudson 1.299), and link to these build artifacts in yet another location.