An unofficial shields.io badge with package version fetched from custom API.
Workflow parameter | API Parameter | Default value | Description | Required | Possible values | |
---|---|---|---|---|---|---|
id | id | null | Package id - can be found using winget search |
Yes | Winget package identifier (ID) | All these parameters (related to workflow only) supports updating multiple package badges at a time without calling the workflow multiple times. Example workflow |
style | style | flat | Style of the badge | No | flat, flat-square, plastic, for-the-badge, plastic, social | |
label | label | Winget package | Override the default left-hand-side text | No | Text (special chars included) | |
label_color | labelColor | gray | Background color of the left part | No | hex, rgb, rgba, hsl, hsla and css named colors supported | |
color | color | blue | Background color of the right part | No | hex, rgb, rgba, hsl, hsla and css named colors supported | |
N/A | image | false | Return version as shields.io badge or just as plain text | No | true or 1, false | |
readme_path | N/A | ./README.md | Path of the markdown file | No | File path relative to the root directory of the GitHub repo | |
marker_text | N/A | null | Start and end markers to identify and update the badge | Yes | Marker text | |
pkg_link | N/A | null | Package or repo link | No | URL of the package repo | |
newline | N/A | true | Add \n after start marker (n/a when html parameter is true) |
No | true, false | |
html | N/A | false | Return badge as html instead of markdown text | No | true, false |
- Make sure to change the following in your GitHub repo settings:
Actions
>General
>Workflow permissions
> ChooseRead and write permissions
> CheckAllow GitHub Actions to create and approve pull requests
>Save
. - Other parameters
commit_user
,commit_email
,commit_message
andconfirm_and_push
related to action workflow are optional. - For fetching multiple package versions
id
andmarker_text
must contain equal number of elements.- Other parameters can either be single element which applies to all the multiple badges or number of elements must be equal to
id
andmarker_text
. - The multiple elements should be semicolon separated and overall wrapped in double quotes.
- Empty elements are allowed for
style
,label_color
andpkg_link
parameters only.
- The README markdown file must contain start marker
<!-- EXAMPLE_MARKER_START -->
and end marker<!-- EXAMPLE_MARKER_END -->
where "EXAMPLE_MARKER" is the input ofmarker_text
parameter. Note that the_START
and_END
part is important. - The fetched versions can be accessed via
outputs.winget_ver
for further usage in the workflow. If multiple versions are fetched then this contains versions separated with ";".
API calling example: https://winget-version-badge.vercel.app/?id=Git.Git&image=true
Workflow examples: Basic workflow | Multi versions | PR only worflow
EXAMPLE_3 | EXAMPLE_4 | EXAMPLE_5 |
---|---|---|
- Since deployed in Vercel, all its limitations applied. Thus it is requested not to abuse the API usage and push it to limits.
- Run the github actions only either after your own package published or using workflow dispatch. It is not recommended to run as scheduled workflow (
cron
) due to vercel rate limits. - Github README happens to have a timeout of around 10s but API takes more than 10s to fetch the version thus it's advised to use the github actions workflow as required instead of using API link directly.
This project is licensed under BSD-3-Clause.
Copyright © 2024, Naveen Prashanth. All Rights Reserved.