Skip to content

Jasstkn/actions-usage

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

actions-usage

Find your GitHub Actions usage across a given organisation (or user account).

Includes total runtime of all workflow runs and workflow jobs, including where the jobs were run within inclusive, free, billed minutes, or on self-hosted runners.

This data is not available within a single endpoint in GitHub's REST or GraphQL APIs, so many different API calls are necessary to build up the usage statistics.

repos = ListRepos(organisation)
   for each Repo
       ListWorkflowRuns(Repo)
          for each WorkflowRun
             jobs = ListWorkflowJobs(WorkflowRun)
sum(jobs)

If your team has hundreds of repositories, or thousands of builds per month, then the tool may exit early due to exceeding the API rate-limit. In this case, we suggest you run with --days=10 and multiply the value by 3 to get a rough picture of 30-day usage.

Usage

This tool is primarily designed for use with an organisation, however you can also use it with a regular user account by changing the --org flag to --user.

Or create a Classic Token with: repo and admin:org and save it to ~/pat.txt. Create a short lived duration for good measure.

Download a binary from the releases page

Output

actions-usage --org openfaas --token $(cat ~/pat.txt)

Fetching last 30 days of data (created>=2023-01-29)

Total repos: 45
Total private repos: 0
Total public repos: 45

Total workflow runs: 95
Total workflow jobs: 113
Total usage: 6h16m16s (376 mins)

As a user:

actions-usage --user alexellis --token $(cat ~/pat.txt)

Development

All changes must be proposed with an Issue prior to working on them or sending a PR. Commits must have a sign-off message, i.e. git commit -s

git clone https://github.com/actuated/actions-usage
cd actions-usage

go run . --org actuated-samples --token $(cat ~/pat.txt)

Author

This tool was created as part of actuated.dev by OpenFaaS Ltd.

Releases

No releases published

Packages

No packages published

Languages

  • Go 83.1%
  • Makefile 16.9%