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

Code before:

// SetImmutableReleaseRepositories sets selected repositories for immutable releases enforcement.
//
// This endpoint replaces all repositories that have been selected for immutable releases enforcement in an organization.
// To use this endpoint, the organization immutable releases policy for enforced_repositories must be configured to selected.
//
// GitHub API docs: https://docs.github.com/rest/orgs/orgs#set-selected-repositories-for-immutable-releases-enforcement
//
//meta:operation PUT /orgs/{org}/settings/immutable-releases/repositories
func (s *OrganizationsService) SetImmutableReleaseRepositories(ctx context.Context, org string, opts *SelectedRepositories) (*Response, error) {
	u := fmt.Sprintf("orgs/%v/settings/immutable-releases/repositories", org)

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

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

	return resp, nil
}

// EnableRepositoryForImmutableRelease enable a selected repository for immutable releases in an organization.
//
// To add a repository to the list of selected repositories that are enforced for immutable releases in an organization.
// To use this endpoint, the organization immutable releases policy for enforced_repositories must be configured to selected.
//
// GitHub API docs: https://docs.github.com/rest/orgs/orgs#enable-a-selected-repository-for-immutable-releases-in-an-organization
//
//meta:operation PUT /orgs/{org}/settings/immutable-releases/repositories/{repository_id}
func (s *OrganizationsService) EnableRepositoryForImmutableRelease(ctx context.Context, org string, repoID int64) (*Response, error) {
	u := fmt.Sprintf("orgs/%v/settings/immutable-releases/repositories/%v", org, repoID)

	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
}

// DisableRepositoryForImmutableRelease disable a selected repository for immutable releases in an organization.
//

Review comment (suggestion):
```suggestion
// EnableRepositoryForImmutableRelease enables a selected repository for immutable releases in an organization.
```

Code after:
		SelectedRepositoryIDs: repositoryIDs,
	}

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

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

	return resp, nil
}

// EnableRepositoryForImmutableRelease enables a selected repository for immutable releases in an organization.
// It requires enforced_repositories to be set to "selected".
//
// GitHub API docs: https://docs.github.com/rest/orgs/orgs#enable-a-selected-repository-for-immutable-releases-in-an-organization
//
//meta:operation PUT /orgs/{org}/settings/immutable-releases/repositories/{repository_id}
func (s *OrganizationsService) EnableRepositoryForImmutableRelease(ctx context.Context, org string, repoID int64) (*Response, error) {
	u := fmt.Sprintf("orgs/%v/settings/immutable-releases/repositories/%v", org, repoID)

	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
}

// DisableRepositoryForImmutableRelease removes a repository from the organization's selected list for immutable releases enforcement.
// It requires enforced_repositories to be set to "selected".
//
// GitHub API docs: https://docs.github.com/rest/orgs/orgs#disable-a-selected-repository-for-immutable-releases-in-an-organization
//
//meta:operation DELETE /orgs/{org}/settings/immutable-releases/repositories/{repository_id}
func (s *OrganizationsService) DisableRepositoryForImmutableRelease(ctx context.Context, org string, repoID int64) (*Response, error) {
	u := fmt.Sprintf("orgs/%v/settings/immutable-releases/repositories/%v", org, repoID)

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