Skip to content

feat: Add Actions cache limits for an organization - #4597

Merged
gmlewis merged 3 commits into
google:masterfrom
NitinKumar004:actions-cache-limits-org
Oct 4, 2026
Merged

gmlewis merged 3 commits into
google:masterfrom
NitinKumar004:actions-cache-limits-org

Conversation

@NitinKumar004

Copy link
Copy Markdown
Contributor

Fixes #4596

Adds the organization-level GitHub Actions cache limit endpoints to ActionsService, next to the existing cache usage methods in actions_cache.go:

  • GetCacheRetentionLimitForOrg / SetCacheRetentionLimitForOrg (GET/PUT /organizations/{org}/actions/cache/retention-limit)
  • GetCacheStorageLimitForOrg / SetCacheStorageLimitForOrg (GET/PUT /organizations/{org}/actions/cache/storage-limit)

The two new types, ActionsCacheRetentionLimit and ActionsCacheStorageLimit, are used for both the GET response and the PUT request body, since the OpenAPI schema is the same for both. The PUT endpoints return 204, so the setters return only (*Response, error), following UpdateArtifactAndLogRetentionPeriodInOrganization.

API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-retention-limit-for-an-organization

Tested with unit tests for each method (happy path, bad options, request/do failure, 404 and invalid org), and script/generate.sh, script/fmt.sh, script/test.sh and script/lint.sh all pass locally. script/metadata.sh unused no longer lists these four operations.

Note: this change was prepared with AI assistance; I reviewed the code and ran the tests.

Add ActionsService methods for the organization-level GitHub Actions
cache retention limit and cache storage limit endpoints.

Fixes google#4596
@google-cla

google-cla Bot commented Sep 27, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.61%. Comparing base (52908e2) to head (ef45b3e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4597   +/-   ##
=======================================
  Coverage   98.60%   98.61%           
=======================================
  Files         198      198           
  Lines       18552    18580   +28     
=======================================
+ Hits        18294    18322   +28     
  Misses        258      258           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis

gmlewis commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

@NitinKumar004 - once you resolve the CLA issue, we can move forward with this PR.

@NitinKumar004

Copy link
Copy Markdown
Contributor Author

@gmlewis I've signed the Google CLA now, using the same email as the commit. Thanks for your patience!

@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. and removed waiting for signed CLA labels Oct 1, 2026

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @NitinKumar004!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @Not-Dhananjay-Mishra

Comment thread github/actions_cache.go
type ActionsCacheStorageLimit struct {
// MaxCacheSizeGB is the maximum size limit for the sum of all caches in a
// repository, in gigabytes.
MaxCacheSizeGB *int `json:"max_cache_size_gb,omitempty"`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just FYI - I just realized that we have not been terribly consistent in the use of integer types for fields representing GigaBytes, so I'm fine to leave this as-is.

$ rg _gb | grep int
github/actions_hosted_runners.go:       MemoryGB  int    `json:"memory_gb"`  // The available RAM for the machine spec. Example: 32
github/actions_hosted_runners.go:       StorageGB int    `json:"storage_gb"` // The available SSD storage for the machine spec. Example: 300
github/actions_hosted_runners.go:       SizeGB      *int64  `json:"size_gb"`      // Image size in GB. Example: 86
github/actions_hosted_runners.go:       SizeGB       int       `json:"size_gb"`
github/actions_hosted_runners.go:       SizeGB      int    `json:"size_gb"`

@Not-Dhananjay-Mishra Not-Dhananjay-Mishra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Oct 4, 2026
@gmlewis

gmlewis commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator

Thank you, @Not-Dhananjay-Mishra!
Merging.

@gmlewis
gmlewis merged commit 9962577 into google:master Oct 4, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Actions cache retention and storage limits for an organization

3 participants