feat: Add repository-level immutable releases settings API#4039
Open
sheeeng wants to merge 1 commit intogoogle:masterfrom
Open
feat: Add repository-level immutable releases settings API#4039sheeeng wants to merge 1 commit intogoogle:masterfrom
sheeeng wants to merge 1 commit intogoogle:masterfrom
Conversation
Add support for the repository-level immutable releases settings
endpoints on RepositoriesService:
- EnableImmutableReleases: PUT /repos/{owner}/{repo}/immutable-releases
- DisableImmutableReleases: DELETE /repos/{owner}/{repo}/immutable-releases
- IsImmutableReleasesEnabled: GET /repos/{owner}/{repo}/immutable-releases
Fixes google#4038.
alexandear
suggested changes
Feb 25, 2026
| @@ -0,0 +1,77 @@ | |||
| // Copyright 2025 The go-github AUTHORS. All rights reserved. | |||
Contributor
There was a problem hiding this comment.
Suggested change
| // Copyright 2025 The go-github AUTHORS. All rights reserved. | |
| // Copyright 2026 The go-github AUTHORS. All rights reserved. |
|
|
||
| // EnableImmutableReleases enables immutable releases for a repository. | ||
| // | ||
| // GitHub API docs: https://docs.github.com/rest/repos/repos#enable-immutable-releases-for-a-repository |
Contributor
There was a problem hiding this comment.
Suggested change
| // GitHub API docs: https://docs.github.com/rest/repos/repos#enable-immutable-releases-for-a-repository | |
| // GitHub API docs: https://docs.github.com/rest/repos/repos#enable-immutable-releases |
|
|
||
| // DisableImmutableReleases disables immutable releases for a repository. | ||
| // | ||
| // GitHub API docs: https://docs.github.com/rest/repos/repos#disable-immutable-releases-for-a-repository |
Contributor
There was a problem hiding this comment.
Suggested change
| // GitHub API docs: https://docs.github.com/rest/repos/repos#disable-immutable-releases-for-a-repository | |
| // GitHub API docs: https://docs.github.com/rest/repos/repos#disable-immutable-releases |
| @@ -0,0 +1,97 @@ | |||
| // Copyright 2025 The go-github AUTHORS. All rights reserved. | |||
Contributor
There was a problem hiding this comment.
Suggested change
| // Copyright 2025 The go-github AUTHORS. All rights reserved. | |
| // Copyright 2026 The go-github AUTHORS. All rights reserved. |
| // GitHub API docs: https://docs.github.com/rest/repos/repos#check-if-immutable-releases-are-enabled-for-a-repository | ||
| // | ||
| //meta:operation GET /repos/{owner}/{repo}/immutable-releases | ||
| func (s *RepositoriesService) IsImmutableReleasesEnabled(ctx context.Context, owner, repo string) (bool, *Response, error) { |
Contributor
There was a problem hiding this comment.
I think this endpoint should return a struct with enabled and enforced_by_owner fields.
See the schema:
{
"title": "Check immutable releases",
"description": "Check immutable releases",
"type": "object",
"properties": {
"enabled": {
"type": "boolean",
"description": "Whether immutable releases are enabled for the repository.",
"examples": [
true
]
},
"enforced_by_owner": {
"type": "boolean",
"description": "Whether immutable releases are enforced by the repository owner.",
"examples": [
false
]
}
},
"required": [
"enabled",
"enforced_by_owner"
]
}
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4039 +/- ##
==========================================
+ Coverage 94.04% 94.09% +0.05%
==========================================
Files 207 208 +1
Lines 19151 19233 +82
==========================================
+ Hits 18010 18097 +87
+ Misses 939 938 -1
+ Partials 202 198 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for the repository-level immutable releases settings API endpoints on
RepositoriesService:EnableImmutableReleases—PUT /repos/{owner}/{repo}/immutable-releasesDisableImmutableReleases—DELETE /repos/{owner}/{repo}/immutable-releasesIsImmutableReleasesEnabled—GET /repos/{owner}/{repo}/immutable-releasesThis follows the same pattern as the private vulnerability reporting methods (
EnablePrivateReporting,DisablePrivateReporting,IsPrivateReportingEnabled) and complements the organization-level immutable releases support added in #3774.Fixes #4038.
GitHub API docs