Introduction
Currently, I'm programming a GitHub Action to facilitate the publishing of JavaDoc to a static web page.
The GitHub repo link of the GitHub Action: https://github.com/MathieuSoysal/Javadoc-publisher.yml
In this project I have this badge to show how many GitHub project uses the GitHub Action.
URL of the badge:
The badge uses this data:
Here is the source code of this service: https://github.com/EndBug/api/blob/main/api/github-actions/used-by.ts
Problem
The badge shows 7 users of GitHub Actions but in fact, is 64.
Question
Does someone know how to make a badge to show how many repos use a GitHub Action?
Your current code
used-by.tsis using Vercel (previously called Zeit) to create a serverless function to return badge data.I would recommend having a more precise search query. For example, searching for the exact file (
filename:javadoc-publisher.yml) might yield more accurate results than a general search.And do add proper error handling to avoid potential issues when making requests to the GitHub API.
But if it is still incorrect, try a more hard-coded
getUsageCount(), just for testing/debugging: