feat: Add repository-level immutable releases settings#4039
Open
sheeeng wants to merge 5 commits intogoogle:masterfrom
Open
feat: Add repository-level immutable releases settings#4039sheeeng wants to merge 5 commits intogoogle:masterfrom
sheeeng wants to merge 5 commits 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
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 19245 +94
==========================================
+ Hits 18010 18109 +99
+ Misses 939 938 -1
+ Partials 202 198 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Collaborator
|
Please run step 4 of CONTRIBUTING.md and push the results. Then we can start reviewing. |
Update copyright years from 2025 to 2026 in both source and test files. Shorten API docs URLs for `EnableImmutableReleases` and `DisableImmutableReleases` methods. Change `IsImmutableReleasesEnabled` to return an exported `*RepoImmutableReleasesStatus` struct with `Enabled` and `EnforcedByOwner` fields instead of a plain bool.
Contributor
Author
|
Appreciate the review, @alexandear! |
Add GetEnabled and GetEnforcedByOwner accessor methods for the `RepoImmutableReleasesStatus` struct with nil-safe checks. Include corresponding unit tests for both accessors.
gmlewis
requested changes
Feb 27, 2026
Collaborator
gmlewis
left a comment
There was a problem hiding this comment.
Thank you, @sheeeng!
Just a couple minor changes, please, then we should be ready for a second LGTM+Approval from any other contributor to this repo before merging.
cc: @alexandear since you already commented.
Rename `IsImmutableReleasesEnabled` to `AreImmutableReleasesEnabled` so the method name reads correctly in English.
Use idiomatic Go zero-value pattern `var status *T` instead of `status := new(T)` in `AreImmutableReleasesEnabled`.
Contributor
Author
$ CGO_ENABLED=0 script/fmt.sh
Time: 0h:00m:51s
$
$ CGO_ENABLED=0 script/lint.sh
linting .
0 issues.
linting example
0 issues.
linting otel
0 issues.
linting scrape
0 issues.
linting tools
0 issues.
linting tools/check-structfield-settings
0 issues.
linting tools/fmtpercentv
0 issues.
linting tools/sliceofpointers
0 issues.
linting tools/structfield
0 issues.
validating generated files
Time: 0h:03m:17s
$
$ CGO_ENABLED=0 script/test.sh
testing .
ok github.com/google/go-github/v82/github 4.718s coverage: 99.2% of statements
github.com/google/go-github/v82/test/fields coverage: 0.0% of statements
? github.com/google/go-github/v82/test/integration [no test files]
testing example
github.com/google/go-github/v82/example/actionpermissions coverage: 0.0% of statements
github.com/google/go-github/v82/example/appengine coverage: 0.0% of statements
github.com/google/go-github/v82/example/basicauth coverage: 0.0% of statements
github.com/google/go-github/v82/example/codespaces/newreposecretwithxcrypto coverage: 0.0% of statements
github.com/google/go-github/v82/example/codespaces/newusersecretwithxcrypto coverage: 0.0% of statements
github.com/google/go-github/v82/example/commitpr coverage: 0.0% of statements
github.com/google/go-github/v82/example/listenvironments coverage: 0.0% of statements
github.com/google/go-github/v82/example/migrations coverage: 0.0% of statements
github.com/google/go-github/v82/example/newfilewithappauth coverage: 0.0% of statements
github.com/google/go-github/v82/example/newrepo coverage: 0.0% of statements
github.com/google/go-github/v82/example/newreposecretwithxcrypto coverage: 0.0% of statements
github.com/google/go-github/v82/example/otel coverage: 0.0% of statements
github.com/google/go-github/v82/example/ratelimit coverage: 0.0% of statements
github.com/google/go-github/v82/example/simple coverage: 0.0% of statements
github.com/google/go-github/v82/example/tokenauth coverage: 0.0% of statements
github.com/google/go-github/v82/example/topics coverage: 0.0% of statements
github.com/google/go-github/v82/example/uploadreleaseassetfromrelease coverage: 0.0% of statements
github.com/google/go-github/v82/example/verifyartifact coverage: 0.0% of statements
testing otel
ok github.com/google/go-github/v82/otel (cached) coverage: 100.0% of statements
testing scrape
ok github.com/google/go-github/scrape (cached) coverage: 59.4% of statements
github.com/google/go-github/scrape/example/scrape coverage: 0.0% of statements
testing tools
tools/gen-release-notes coverage: 0.0% of statements
ok tools/metadata 1.578s coverage: 81.5% of statements
testing tools/check-structfield-settings
github.com/google/go-github/v82/tools/check-structfield-settings coverage: 0.0% of statements
testing tools/fmtpercentv
ok tools/fmtpercentv (cached) coverage: 81.2% of statements
testing tools/sliceofpointers
ok tools/sliceofpointers (cached) coverage: 94.7% of statements
testing tools/structfield
ok github.com/google/go-github/v82/tools/structfield (cached) coverage: 93.6% of statements
$ |
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