integrations / integrations/terraform-provider-github
[FEAT]: Manage GitHub Actions artifact and log retention
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 1k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 8
Description
### Describe the need
GitHub Actions artifact and log retention (Settings -> Actions -> General -> Artifact and log retention) cannot be managed by this provider today, so it stays a manual click for every repository and organization we otherwise manage entirely in Terraform. It is a storage-cost and data-retention control, so leaving it outside Terraform means it drifts and is invisible in review.
The REST API supports it at both scopes:
- `GET`/`PUT /repos/{owner}/{repo}/actions/permissions/artifact-and-log-retention` ([docs](https://docs.github.com/en/rest/actions/permissions#get-artifact-and-log-retention-settings-for-a-repository))
- `GET`/`PUT /orgs/{org}/actions/permissions/artifact-and-log-retention` ([docs](https://docs.github.com/en/rest/actions/permissions#get-artifact-and-log-retention-settings-for-an-organization))
`go-github` already exposes both (`Repositories.GetArtifactAndLogRetentionPeriod` / `UpdateArtifactAndLogRetentionPeriod`, `Actions.GetArtifactAndLogRetentionPeriodInOrganization` / `UpdateArtifactAndLogRetentionPeriodInOrganization`), and the version pinned in this repo's `go.mod` includes them.
This was previously requested in #2150 and closed as not planned in November 2024 because the API did not support it at the time. These endpoints have shipped since, so the reason for closing no longer holds.
### GitHub Installation Type
- [x] GitHub.com (Free, Pro, or Team)
### Relevant log output
Both endpoints respond on a plain github.com organization:
```shell
$ gh api repos/OWNER/REPO/actions/permissions/artifact-and-log-retention
{
"days": 90,
"maximum_allowed_days": 90
}
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Start with the repository and organization REST endpoints and compare them with the corresponding go-github methods named in the issue. Run the provided gh api request, then inspect existing provider patterns for scoped settings; done means Terraform manages and detects drift in artifact and log retention at both scopes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, github-actions, go, terraform
- Domain
- devops, infrastructure
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100