Skip to content

Set GitHub Actions cache retention limit for a repository

PUT
/repos/{owner}/{repo}/actions/cache/retention-limit

Sets GitHub Actions cache retention limit for a repository. This determines how long caches will be retained for, if not manually removed or evicted due to size constraints.

OAuth tokens and personal access tokens (classic) need the admin:repository scope to use this endpoint.

API method documentation

owner
required
string

The account owner of the repository. The name is not case sensitive.

repo
required
string

The name of the repository without the .git extension. The name is not case sensitive.

Media type application/json
Actions cache retention limit for a repository

GitHub Actions cache retention policy for a repository.

object
max_cache_retention_days

The maximum number of days to keep caches in this repository.

integer
Examples
Example selected_actions
{
"max_cache_retention_days": 80
}

Response

Bad Request

Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Forbidden

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Resource not found

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}