Skip to content
tag

GitHub Action

Winget Badge Update

v1.0.3 Latest version

Winget Badge Update

tag

Winget Badge Update

Showcase your number of merged pull requests in profile's README dynamically

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Winget Badge Update

uses: gnpaone/[email protected]

Learn more about this action in gnpaone/winget-version-badge

Choose a version

Winget Version Badge

Releases Build LICENSE Vercel Issues GitHub Marketplace

Get your own latest version number badge for your Winget package


Introduction

An unofficial shields.io badge with package version fetched from custom API.

API Query Parameters

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

Notes for the workflow:

  • Make sure to change the following in your GitHub repo settings: Actions > General > Workflow permissions > Choose Read and write permissions > Check Allow GitHub Actions to create and approve pull requests > Save.
  • Other parameters commit_user, commit_email, commit_message and confirm_and_push related to action workflow are optional.
  • For fetching multiple package versions
    • id and marker_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 and marker_text.
    • The multiple elements should be semicolon separated and overall wrapped in double quotes.
    • Empty elements are allowed for style, label_color and pkg_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 of marker_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 ";".

Usage

API calling example: https://winget-version-badge.vercel.app/?id=Git.Git&image=true
Workflow examples: Basic workflow | Multi versions | PR only worflow

GitHub.cli Git.Git

EXAMPLE_3 EXAMPLE_4 EXAMPLE_5
Git.MinGit GitHub.GitHubDesktop GitHub.GitLFS
Gitleaks.Gitleaks

Limitations

  • 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.

License

This project is licensed under BSD-3-Clause.
Copyright © 2024, Naveen Prashanth. All Rights Reserved.