count-action-users
Overview
The count-action-users GitHub Action is a meta-action to monitor and report the number of users of a GitHub Action. It generates a Shields endpoint with the count of the number of workflows that use a GitHub Action. It is thus a tool for maintainers of GitHub Actions, and it can be used to insert a badge with a users count into the README for a GitHub Action. The key features include the following:
- Designed to Run on a Schedule: The intended usage is to run the action on a schedule (e.g., nightly) to update the endpoint.
- Customizable: It is configurable in a number of ways (e.g., badge color, logo, style) using action inputs, but you can also override these things when you embed the badge using Shield's URL parameters.
- Multiple Action Support: For those who maintain multiple GitHub Actions, the count-action-users action accepts a list of GitHub Actions as an input, generating endpoints for all actions in the list. In this way, a single run of the action in a single workflow in a single repository is sufficient to regularly monitor the number of users of all of the actions that you maintain. Or, if you prefer, you can run the action separately within the repositories of each action.
The count-action-users GitHub Action is implemented in Python, and the source code repository is hosted on GitHub; and it is licensed under the MIT License. Also in the GitHub repository you will find detailed instructions for use including several sample GitHub workflows.
The count-action-users GitHub Action is developed by Vincent A. Cicirello. It was originally implemented for my own use in monitoring the several GitHub Actions that I maintain, but I have decided to share it with others.
Live Examples
Because it features the ability to monitor multiple GitHub Actions from a single workflow, I have one live example, which is the workflow for all of my currently maintained GitHub Actions: count-action-users.yml. The JSON endpoints generated by this workflow can be found at the root of this repository: https://github.com/cicirello/endpoints. That repository also contains JSON endpoints for generating other status badges. To inspect one of the relevant JSON files as a sample, consider jacoco-badge-generator.json.
Tech Stack
The count-action-users GitHub Action utilizes the following:
- Python 3 (implemented almost entirely in Python);
- The pyaction Docker container, which is a Docker container designed to support GitHub Actions development in the Python language (also see pyaction's GitHub repository);
- The cicirello/python-github-action-template repository, a template that we maintain to assist developers getting started developing a GitHub Action in Python;
- GitHub CLI;
- JSON for the output (e.g., it outputs Shields endpoints);
- Docker since it is implemented as a container action; and
- GitHub Container Registry, which is where we pull pyaction from at runtime for faster action loading (e.g., pulling the base Docker container from GitHub while an action is running on a GitHub server should be faster than pulling from Docker Hub).