Skip to content

Track repo visibility; surface public repos in output; fix JSON tags#46

Open
Copilot wants to merge 4 commits intomainfrom
copilot/check-gh-actions-usage
Open

Track repo visibility; surface public repos in output; fix JSON tags#46
Copilot wants to merge 4 commits intomainfrom
copilot/check-gh-actions-usage

Conversation

Copy link
Contributor

Copilot AI commented Mar 9, 2026

GitHub's /timing API only reports billable minutes for private repos — public repos always return 0ms. The tool showed 0ms for public-repo workflows with no explanation.

Changes

  • client/client.go

    • Add Private bool \json:"private"`toRepository` — populated from the GitHub API response for every repo fetch
    • Add missing json:"billable" tag to Usage.Billable (was triggering musttag linter on json.Unmarshal callsites)
  • format/usage_summary.go — propagate Private from Repository into repoSummary

  • format/human_formatter.go — append ; public to the repo header when !repo.Private:

    geoffreywiseman/gh-actuse (0 workflows; 0ms; public)
    myorg/open-source-lib (2 workflows; 0ms; public):
    - CI (.github/workflows/ci.yml, active, 0ms)
    
  • Tests — mark private test repos Private: true; add TestHumanFormatter_PublicRepo and TestHumanFormatter_PublicRepo_NoWorkflows; fix redundant &UsageDetails{…} literals in map initializers


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

… map

The Billable field in Usage was a named struct with only Ubuntu, Macos, and
Windows fields. Any runner environment keys returned by GitHub's API that
don't match those three names (e.g. UBUNTU_ARM for ARM64 runners, or any
future runner types) were silently dropped, causing TotalMs() to return 0.

Change Billable to map[string]*UsageDetails so all runner environments are
captured regardless of their key name. Update TotalMs() to iterate the map.

Add JSON deserialization tests to verify both the standard API keys
(UBUNTU, MACOS, WINDOWS) and additional runner types are counted correctly.

Co-authored-by: geoffreywiseman <49935+geoffreywiseman@users.noreply.github.com>
Copilot AI changed the title [WIP] Verify GitHub Actions usage for recent builds Fix TotalMs() missing usage from non-standard runner environments Mar 9, 2026
@geoffreywiseman geoffreywiseman marked this pull request as ready for review March 9, 2026 03:24
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 9, 2026
@geoffreywiseman geoffreywiseman requested a review from Copilot March 9, 2026 03:24
@dosubot dosubot bot added the bug Something isn't working label Mar 9, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the GitHub Actions timing usage model so Usage.TotalMs() includes billable time from any runner environment key returned by the GitHub API (not just Ubuntu/MacOS/Windows), preventing silent drops for new/non-standard runner types.

Changes:

  • Replace Usage.Billable from a fixed struct to map[string]*UsageDetails.
  • Update TotalMs() to sum across all billable map entries.
  • Update and extend unit tests to cover API JSON formats and additional runner types.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
client/client.go Switch billable usage to a map and sum all entries in TotalMs()
client/client_test.go Update mocks/tests for the new billable shape and add JSON unmarshal coverage

geoffreywiseman and others added 2 commits March 8, 2026 23:29
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The GitHub workflow /timing API only tracks billable minutes for private
repositories. Public repos always return 0ms. Add a `Private bool` field
(json:"private") to Repository so the tool knows each repo's visibility,
then show "; public" in the human formatter's repo header line whenever a
repo is not private. This explains to users why they see 0ms for public
repos instead of leaving them wondering if something is broken.

Also add the missing json:"billable" tag to Usage.Billable (map field was
missing its tag, causing musttag linter failures), and add json:"private"
to Repository.Private for completeness.

Fix redundant &UsageDetails{} literals in test (pointer type already
implied by map value type).

Co-authored-by: geoffreywiseman <49935+geoffreywiseman@users.noreply.github.com>
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Mar 9, 2026
Copilot AI changed the title Fix TotalMs() missing usage from non-standard runner environments Track repo visibility; surface public repos in output; fix JSON tags Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants