Skip to content

Add Badges

Add Badges #13

Workflow file for this run

# This action use https://github.com/wow-actions/add-badges?tab=readme-ov-file to add badges to your README.md file.
name: Add Badges
on:
# we are using workflow_run to trigger the workflow
# because we want to run this workflow only when the Approve PR and delete branch workflow is completed
# GitHub prevents workflows from running on events that were caused by other workflows to prevent unlimited recursion
# so we do not use the release event
# issue: https://github.com/orgs/community/discussions/25281
# see: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run
workflow_run:
# the workflow we want to trigger this workflow (see .github/workflows/automerge.yml)
workflows: [Approve PR and delete branch]
types: [completed]
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/add-badges@v1
env:
repo_url: ${{ github.event.repository.html_url }}
repo_name: ${{ github.event.repository.name }}
repo_owner: ${{ github.event.repository.owner.login }}
with:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
badges: |
[
{
"badge": "https://img.shields.io/npm/v/${{ env.repo_name }}?style=flat-square",
"alt": "NPM Version",
"link": "https://www.npmjs.com/package/${{ env.repo_name }}"
},
{
"badge": "https://img.shields.io/badge/language-TypeScript-blue.svg?style=flat-square",
"alt": "Language",
"link": "https://www.typescriptlang.org"
}
]
# if adding the last commit badge
# {
# "badge": "https://img.shields.io/github/last-commit/${{ env.repo_owner }}/${{ env.repo_name }}?style=flat-square",
# "alt": "Last Commit",
# "link": "${{ env.repo_url }}/commits/master"
# }