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

Code before:

// CreateTagProtection creates the tag protection of the specified repository.
// Deprecated: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#create-a-repository-ruleset
//
// GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---create-a-tag-protection-state-for-a-repository
//
//meta:operation POST /repos/{owner}/{repo}/tags/protection
func (s *RepositoriesService) CreateTagProtection(ctx context.Context, owner, repo, pattern string) (*TagProtection, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/tags/protection", owner, repo)
	r := &tagProtectionRequest{Pattern: pattern}
	req, err := s.client.NewRequest("POST", u, r)
	if err != nil {
		return nil, nil, err
	}

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

	return tagProtection, resp, nil
}

// DeleteTagProtection deletes a tag protection from the specified repository.
// Deprecated: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#delete-a-repository-ruleset
//
// GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---delete-a-tag-protection-state-for-a-repository
//
//meta:operation DELETE /repos/{owner}/{repo}/tags/protection/{tag_protection_id}
func (s *RepositoriesService) DeleteTagProtection(ctx context.Context, owner, repo string, tagProtectionID int64) (*Response, error) {
	u := fmt.Sprintf("repos/%v/%v/tags/protection/%v", owner, repo, tagProtectionID)
	req, err := s.client.NewRequest("DELETE", u, nil)
	if err != nil {
		return nil, err
	}

	return s.client.Do(ctx, req, nil)
}


Review comment (suggestion):
```suggestion
// DeleteTagProtection deletes a tag protection from the specified repository.
//
// Deprecated: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#delete-a-repository-ruleset
```

Code after:
}

// CreateTagProtection creates the tag protection of the specified repository.
//
// Deprecated: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#create-a-repository-ruleset
//
// GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---create-a-tag-protection-state-for-a-repository
//
//meta:operation POST /repos/{owner}/{repo}/tags/protection
func (s *RepositoriesService) CreateTagProtection(ctx context.Context, owner, repo, pattern string) (*TagProtection, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/tags/protection", owner, repo)
	r := &tagProtectionRequest{Pattern: pattern}
	req, err := s.client.NewRequest("POST", u, r)
	if err != nil {
		return nil, nil, err
	}

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

	return tagProtection, resp, nil
}

// DeleteTagProtection deletes a tag protection from the specified repository.
//
// Deprecated: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#delete-a-repository-ruleset
//
// GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---delete-a-tag-protection-state-for-a-repository
//
//meta:operation DELETE /repos/{owner}/{repo}/tags/protection/{tag_protection_id}
func (s *RepositoriesService) DeleteTagProtection(ctx context.Context, owner, repo string, tagProtectionID int64) (*Response, error) {
	u := fmt.Sprintf("repos/%v/%v/tags/protection/%v", owner, repo, tagProtectionID)
	req, err := s.client.NewRequest("DELETE", u, nil)
	if err != nil {
		return nil, err
	}

	return s.client.Do(ctx, req, nil)
}