Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: Add repository-level immutable releases settings API#4039

Open
sheeeng wants to merge 1 commit intogoogle:masterfrom
sheeeng:feature/repo-immutable-releases
Open

feat: Add repository-level immutable releases settings API#4039
sheeeng wants to merge 1 commit intogoogle:masterfrom
sheeeng:feature/repo-immutable-releases

Conversation

@sheeeng
Copy link
Contributor

@sheeeng sheeeng commented Feb 25, 2026

Summary

Add support for the repository-level immutable releases settings API endpoints on RepositoriesService:

  • EnableImmutableReleasesPUT /repos/{owner}/{repo}/immutable-releases
  • DisableImmutableReleasesDELETE /repos/{owner}/{repo}/immutable-releases
  • IsImmutableReleasesEnabledGET /repos/{owner}/{repo}/immutable-releases

This 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

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.
@@ -0,0 +1,77 @@
// Copyright 2025 The go-github AUTHORS. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link

codecov bot commented Feb 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.09%. Comparing base (e3c4fb5) to head (62d0c75).
⚠️ Report is 15 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for repository-level immutable releases settings API

2 participants