6

Each time I create a PR or make commits, I have some workflows running. But since I have a private repo and I get only 2000 min/month for running workflows on Github Actions, I wanted to track the time used. How do I know how much total time I used out of 2000 free min that Github provides?

Is there a place in Github UI that you see the total time you used/ total time remaining?

Jhanvi
  • 81
  • 1
  • 4

4 Answers4

8

Once you are logged in to GitHub, you can view the GitHub actions minutes usage for your account at https://github.com/settings/billing under GitHub Actions as shown below

enter image description here

The above is documented in GitHub help too.

Madhu Bhat
  • 13,559
  • 2
  • 38
  • 54
1

The best you can get is the view in the main actions tab:

behold my picture editing skills

Sadly, no simple sum/month or anything like that was added as of yet.

The next best thing you could try is to whip up a script that collects these values from the page's dom for you.

Arne
  • 17,706
  • 5
  • 83
  • 99
0

could use github cli to do this

createdAt=$(gh -R ${GITHUB_REPOSITORY}  run list \
  --json databaseId,createdAt --jq ".[]|select(.databaseId==${{ github.run_id }})|.createdAt")
usedSec=$(( `date +%s` - `date -d "$createdAt" +%s`  ))
张馆长
  • 1,321
  • 10
  • 11
0

Since the question was whether it is possible to get usage information per workflow from GitHub UI: no, it doesn't look like that's possible.

But you can install GitHub CLI and get this information from their REST API .e.g

gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/<owner>/<repo_name>/actions/workflows/<workflow_file_name>.yml/timing

It will present an output such as this:

{
  "billable": {
    "UBUNTU": {
      "total_ms": 17920000
    }
  }
}

As it's a REST API, you can also consume it in other ways, such as with cURL, of course. I found it faster to use to use the CLI (although it gave me some random "Server Error" sometimes).

Also found this GitHub Action, which was developed by a third party: GitHub Actions Usage Audit Haven't tested it, though.

joliver
  • 131
  • 1
  • 8