feat: Add Actions cache limits for an organization - #4597
NitinKumar004 wants to merge 2 commits into
Conversation
Add ActionsService methods for the organization-level GitHub Actions cache retention limit and cache storage limit endpoints. Fixes google#4596
|
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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4597 +/- ##
=======================================
Coverage 98.60% 98.60%
=======================================
Files 198 198
Lines 18538 18566 +28
=======================================
+ Hits 18279 18307 +28
Misses 259 259 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@NitinKumar004 - once you resolve the CLA issue, we can move forward with this PR. |
|
@gmlewis I've signed the Google CLA now, using the same email as the commit. Thanks for your patience! |
gmlewis
left a comment
There was a problem hiding this comment.
Thank you, @NitinKumar004!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
| 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"` |
There was a problem hiding this comment.
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"`
Fixes #4596
Adds the organization-level GitHub Actions cache limit endpoints to
ActionsService, next to the existing cache usage methods inactions_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,
ActionsCacheRetentionLimitandActionsCacheStorageLimit, 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), followingUpdateArtifactAndLogRetentionPeriodInOrganization.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.shandscript/lint.shall pass locally.script/metadata.sh unusedno longer lists these four operations.Note: this change was prepared with AI assistance; I reviewed the code and ran the tests.