Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ linters:
- RequiredStatusChecksRequest
- ReviewCustomDeploymentProtectionRuleRequest
- SCIMUserAttributes
- SarifAnalysis
- SecretScanningAlertUpdateOptions
- SecretScanningPatternConfigsUpdateOptions
- SourceImportAuthor
Expand Down
9 changes: 5 additions & 4 deletions github/code_scanning.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,13 @@ type ScanningAnalysis struct {
//
// GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28
type SarifAnalysis struct {
CommitSHA *string `json:"commit_sha,omitempty"`
Ref *string `json:"ref,omitempty"`
Sarif *string `json:"sarif,omitempty"`
CommitSHA string `json:"commit_sha"`
Ref string `json:"ref"`
Sarif string `json:"sarif"`
CheckoutURI *string `json:"checkout_uri,omitempty"`
StartedAt *Timestamp `json:"started_at,omitempty"`
ToolName *string `json:"tool_name,omitempty"`
Validate *bool `json:"validate,omitempty"`
}

// CodeScanningAlertState specifies the state of a code scanning alert.
Expand Down Expand Up @@ -392,7 +393,7 @@ func (s *CodeScanningService) ListAlertInstances(ctx context.Context, owner, rep
// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#upload-an-analysis-as-sarif-data
//
//meta:operation POST /repos/{owner}/{repo}/code-scanning/sarifs
func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo string, body *SarifAnalysis) (*SarifID, *Response, error) {
func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo string, body SarifAnalysis) (*SarifID, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/code-scanning/sarifs", owner, repo)

req, err := s.client.NewRequest(ctx, "POST", u, body)
Expand Down
2 changes: 1 addition & 1 deletion github/code_scanning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestCodeScanningService_UploadSarif(t *testing.T) {
URL: Ptr("https://example.com/testurl"),
}

sarifAnalysis := &SarifAnalysis{CommitSHA: Ptr("abc"), Ref: Ptr("ref/head/main"), Sarif: Ptr("abc"), CheckoutURI: Ptr("uri"), StartedAt: &referenceTimestamp, ToolName: Ptr("codeql-cli")}
sarifAnalysis := SarifAnalysis{CommitSHA: "abc", Ref: "ref/head/main", Sarif: "abc", CheckoutURI: Ptr("uri"), StartedAt: &referenceTimestamp, ToolName: Ptr("codeql-cli"), Validate: Ptr(true)}

mux.HandleFunc("/repos/o/r/code-scanning/sarifs", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
Expand Down
26 changes: 17 additions & 9 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 14 additions & 12 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading