Minute usage per repo/workflow?

Is there a way to see the amount of minutes used by the actions of a repo or even a specific workflow? We seem to be gobbling up minutes, and I would like to understand which repo and workflow is causing that - but couldn’t find anything :confused:

2 Likes

Minute limits of Github actions are per user/organization. You can check the total time consumed for each platform in the billing, for each repo/workflow, please ask private support for more details.

So you are saying there is no way to get the minute usage of a repo or workflow besides contacting support?
Is this planned?

Yes, currently there is no way to get this. 

Metered billing work for adding this in is being tracked in internal ticket, thanks.

You should soon see an export to CSV button in your billing settings that will enable you answer more detailed billing questions like how many minutes a given repo is using.  

2 Likes

Since CSV export does not appear to be possible yet, I hacked together a little snippet you can paste in your browser console to get minutes usage by repo/workflow:

// your GH account needs owner role
var org = 'some_org';
// create token at https://github.com/settings/tokens
// It needs at least read:user, read:org, repo, workflow permissions
var token = 'some_token';

var get = function(url) { 
  return fetch(`https://api.github.com/${url}`, {
    headers: new Headers({
      'Authorization': `token ${token}`
    })
  }).then(_ => _.json().then(response => Promise.resolve(response)))
}

var results = []; 
get(`orgs/${org}/repos`).then(repos => repos.forEach(repo =>
  get(`repos/${org}/${repo.name}/actions/workflows`).then(workflows => workflows.workflows.forEach(workflow =>
    get(`repos/${org}/${repo.name}/actions/workflows/${workflow.id}/timing`).then(timing => results.push({
      repo: repo.name,
      workflow: workflow.name,
      minutes: Math.round((Object.values(timing.billable).map(v => v.total_ms).reduce((acc, v) => acc + v, 0)) / 6000)})))
)));

setTimeout(() =>
  console.table(results.sort((a, b) => b.minutes - a.minutes)),
2000) // feel free to make it less race-conditiony if you need dependable code