查找您在 GitHub Actions 上的总使用量
Find your GitHub Actions usage across a given organisation or user account.
Example console output for the inlets OSS repos
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 || user)
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.
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.
We recommend using arkade to install this CLI, however you can also download a binary from the releases page.
# sudo is optional for this step
curl -SLs https://get.arkade.dev | sudo sh
arkade get actions-usage
sudo mv $HOME/.arkade/bin/actions-usage /usr/local/bin/We sometimes ask users to run this tool before a call with the actuated team. It helps us gauge your usage, find potential wins and recommend a plan/server.
actions-usage \
--by-repo \
--punch-card \
--org openfaas \
--token-file ~/pat.txt \
--days 28If you have either a large or a busy repo - you may want to run with --days 14 or --days 7 once your rate limit has reset.
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $(cat ~/pat.txt)"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/rate_limitIf you're still unable to get the tool to run within your rate-limit, even with 7 days of data, the billing summary from your organisation for actions minutes and what plan you're on could also work, but is quite coarse in comparison.
Example output:
Usage report generated by self-actuated/actions-usage.
Total repos: 44
Total private repos: 0
Total public repos: 44
Total workflow runs: 128
Total workflow jobs: 173
Total users: 4
Longest build: 13m50s
Average build time: 2m55s
Total usage: 8h24m21s (504 mins)You can also run the tool against your personal account:
actions-usage --user alexellis --token-file ~/pat.txtGet a punch-card of which days have the most commits by adding the -punch-card flag:
Day Builds
Monday 7
Tuesday 22
Wednesday 43
Thursday 49
Friday 19
Saturday 4
Sunday 12
Total 156You can use the -by-repo flag to get a detailed breakdown of usage by GitHub repository - sorted by number of builds.
…You can filter the output by specifying repositories to include with the -include and/or -include-file option.
…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-file ~/pat.txtThis tool was created as part of actuated - secure, fast BYO runners for GitHub Actions. actuated is developed by OpenFaaS Ltd.
Within the dashboard, customers get built-in charts for overall usage on a GitHub organisation and a repo-level break down of passing/failing builds and total time spent in each.
MIT
Contributions are welcome, however an Issue must be raised and approved before submitting a PR.
For typos, raise an Issue and a contributor will fix this. It's easier for everyone that way.
暂无开放 Issues,或尚未同步最近议题。