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

Code before:
}

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

	req, err := s.client.NewRequest("PUT", 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
}

// DisableImmutableReleases disables immutable releases for a repository.
//
// 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) {

Review comment (suggestion):
```suggestion
// GitHub API docs: https://docs.github.com/rest/repos/repos#disable-immutable-releases
```

Code after:
	EnforcedByOwner *bool `json:"enforced_by_owner,omitempty"`
}

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

	req, err := s.client.NewRequest("PUT", 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
}

// DisableImmutableReleases disables immutable releases for a repository.
//
// 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