Quick Overview
This workflow runs daily to track GitHub Actions usage across selected repositories, combines recent workflow-run stats with GitHub Actions billing data, calculates budget burn rate and projected spend, and posts a summary to Slack with an additional alert when usage exceeds a defined threshold.
How it works
- Runs on a daily schedule.
- Reads configuration values (repo owner, repo list, budget minutes, cost per minute, and Slack channel) and expands the comma-separated repo list into individual repositories.
- Calls the GitHub REST API for each repository to fetch recent GitHub Actions workflow runs and aggregates run counts and failures by workflow name.
- Fetches organization-level GitHub Actions billing data from the GitHub billing API.
- Calculates minutes used vs. budget, billable minutes, estimated cost, projected full-month usage, and whether the alert threshold is exceeded.
- Formats a Slack message containing the usage/budget metrics and a breakdown of recent workflow activity.
- Posts an urgent Slack warning if the threshold is exceeded; otherwise it posts the daily summary to Slack.
Setup
- Add GitHub credentials (OAuth2 or a PAT) with access to the target repos and permission to read Actions billing (typically
admin:org read, plus repo as needed).
- Add a Slack credential with permission to post messages (
chat:write) and set the target channel in the configuration.
- Update the configuration values for repo owner, repositories to monitor, monthly budget minutes, alert threshold percent, and cost per minute.
- If you monitor a personal account instead of an organization, change the billing endpoint to
/users/{owner}/settings/billing/actions in the GitHub billing request.