Repository: google/go-github
File: github/repos_immutable_releases.go (Go)

Code before:
// GitHub API docs: https://docs.github.com/rest/repos/repos#disable-immutable-releases-for-a-repository
//
//meta:operation DELETE /repos/{owner}/{repo}/immutable-releases
func (s *RepositoriesService) DisableImmutableReleases(ctx context.Context, owner, repo string) (*Response, error) {
	u := fmt.Sprintf("repos/%v/%v/immutable-releases", owner, repo)

	req, err := s.client.NewRequest("DELETE", u, nil)
	if err != nil {
		return nil, err
	}

	resp, err := s.client.Do(ctx, req, nil)
	if err != nil {
		return resp, err
	}

	return resp, nil
}

// IsImmutableReleasesEnabled checks if immutable releases are enabled for
// the repository and returns a boolean indicating the status.
//
// 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) {
	u := fmt.Sprintf("repos/%v/%v/immutable-releases", owner, repo)

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return false, nil, err
	}

	immutableReleases := new(checkImmutableReleases)
	resp, err := s.client.Do(ctx, req, immutableReleases)
	return immutableReleases.Enabled, resp, err
}


Review comment (suggestion):
I think this endpoint should return a struct with `enabled` and `enforced_by_owner` fields.

See the schema:
```json
{
  "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"
  ]
}
```

Code after:
//
// GitHub API docs: https://docs.github.com/rest/repos/repos#disable-immutable-releases
//
//meta:operation DELETE /repos/{owner}/{repo}/immutable-releases
func (s *RepositoriesService) DisableImmutableReleases(ctx context.Context, owner, repo string) (*Response, error) {
	u := fmt.Sprintf("repos/%v/%v/immutable-releases", owner, repo)

	req, err := s.client.NewRequest("DELETE", u, nil)
	if err != nil {
		return nil, err
	}

	resp, err := s.client.Do(ctx, req, nil)
	if err != nil {
		return resp, err
	}

	return resp, nil
}

// AreImmutableReleasesEnabled checks if immutable releases are enabled for
// the repository.
//
// 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) AreImmutableReleasesEnabled(ctx context.Context, owner, repo string) (*RepoImmutableReleasesStatus, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/immutable-releases", owner, repo)

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	var status *RepoImmutableReleasesStatus
	resp, err := s.client.Do(ctx, req, &status)
	if err != nil {
		return nil, resp, err
	}

	return status, resp, nil
}