...

Source file src/github.com/google/go-github/v55/github/security_advisories.go

Documentation: github.com/google/go-github/v55/github

     1  // Copyright 2023 The go-github AUTHORS. All rights reserved.
     2  //
     3  // Use of this source code is governed by a BSD-style
     4  // license that can be found in the LICENSE file.
     5  
     6  package github
     7  
     8  import (
     9  	"context"
    10  	"fmt"
    11  )
    12  
    13  type SecurityAdvisoriesService service
    14  
    15  // RequestCVE requests a Common Vulnerabilities and Exposures (CVE) for a repository security advisory.
    16  // The ghsaID is the GitHub Security Advisory identifier of the advisory.
    17  //
    18  // GitHub API docs: https://docs.github.com/en/rest/security-advisories/repository-advisories#request-a-cve-for-a-repository-security-advisory
    19  func (s *SecurityAdvisoriesService) RequestCVE(ctx context.Context, owner, repo, ghsaID string) (*Response, error) {
    20  	url := fmt.Sprintf("repos/%v/%v/security-advisories/%v/cve", owner, repo, ghsaID)
    21  
    22  	req, err := s.client.NewRequest("POST", url, nil)
    23  	if err != nil {
    24  		return nil, err
    25  	}
    26  
    27  	resp, err := s.client.Do(ctx, req, nil)
    28  	if err != nil {
    29  		if _, ok := err.(*AcceptedError); ok {
    30  			return resp, nil
    31  		}
    32  
    33  		return resp, err
    34  	}
    35  
    36  	return resp, nil
    37  }
    38  

View as plain text