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: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ linters:
enabled-checks:
- commentedOutCode
- commentFormatting
- paramTypeCombine
goheader:
values:
regexp:
Expand Down
4 changes: 2 additions & 2 deletions example/codespaces/newreposecretwithxcrypto/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func getSecretValue(secretName string) (string, error) {
//
// Finally, the github.EncodedSecret is passed into the GitHub client.Codespaces.CreateOrUpdateRepoSecret method to
// populate the secret in the GitHub repo.
func addRepoSecret(ctx context.Context, client *github.Client, owner string, repo, secretName string, secretValue string) error {
func addRepoSecret(ctx context.Context, client *github.Client, owner, repo, secretName, secretValue string) error {
publicKey, _, err := client.Codespaces.GetRepoPublicKey(ctx, owner, repo)
if err != nil {
return err
Expand All @@ -140,7 +140,7 @@ func addRepoSecret(ctx context.Context, client *github.Client, owner string, rep
return nil
}

func encryptSecretWithPublicKey(publicKey *github.PublicKey, secretName string, secretValue string) (*github.EncryptedSecret, error) {
func encryptSecretWithPublicKey(publicKey *github.PublicKey, secretName, secretValue string) (*github.EncryptedSecret, error) {
decodedPublicKey, err := base64.StdEncoding.DecodeString(publicKey.GetKey())
if err != nil {
return nil, fmt.Errorf("unable to decode public key: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion example/codespaces/newusersecretwithxcrypto/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func addUserSecret(ctx context.Context, client *github.Client, secretName, secre
return nil
}

func encryptSecretWithPublicKey(publicKey *github.PublicKey, secretName string, secretValue string) (*github.EncryptedSecret, error) {
func encryptSecretWithPublicKey(publicKey *github.PublicKey, secretName, secretValue string) (*github.EncryptedSecret, error) {
decodedPublicKey, err := base64.StdEncoding.DecodeString(publicKey.GetKey())
if err != nil {
return nil, fmt.Errorf("base64.StdEncoding.DecodeString was unable to decode public key: %v", err)
Expand Down
4 changes: 2 additions & 2 deletions example/newreposecretwithlibsodium/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func getSecretValue(secretName string) (string, error) {
//
// Finally, the github.EncodedSecret is passed into the GitHub client.Actions.CreateOrUpdateRepoSecret method to
// populate the secret in the GitHub repo.
func addRepoSecret(ctx context.Context, client *github.Client, owner string, repo, secretName string, secretValue string) error {
func addRepoSecret(ctx context.Context, client *github.Client, owner, repo, secretName, secretValue string) error {
publicKey, _, err := client.Actions.GetRepoPublicKey(ctx, owner, repo)
if err != nil {
return err
Expand All @@ -136,7 +136,7 @@ func addRepoSecret(ctx context.Context, client *github.Client, owner string, rep
return nil
}

func encryptSecretWithPublicKey(publicKey *github.PublicKey, secretName string, secretValue string) (*github.EncryptedSecret, error) {
func encryptSecretWithPublicKey(publicKey *github.PublicKey, secretName, secretValue string) (*github.EncryptedSecret, error) {
decodedPublicKey, err := base64.StdEncoding.DecodeString(publicKey.GetKey())
if err != nil {
return nil, fmt.Errorf("base64.StdEncoding.DecodeString was unable to decode public key: %v", err)
Expand Down
4 changes: 2 additions & 2 deletions example/newreposecretwithxcrypto/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func getSecretValue(secretName string) (string, error) {
//
// Finally, the github.EncodedSecret is passed into the GitHub client.Actions.CreateOrUpdateRepoSecret method to
// populate the secret in the GitHub repo.
func addRepoSecret(ctx context.Context, client *github.Client, owner string, repo, secretName string, secretValue string) error {
func addRepoSecret(ctx context.Context, client *github.Client, owner, repo, secretName, secretValue string) error {
publicKey, _, err := client.Actions.GetRepoPublicKey(ctx, owner, repo)
if err != nil {
return err
Expand All @@ -140,7 +140,7 @@ func addRepoSecret(ctx context.Context, client *github.Client, owner string, rep
return nil
}

func encryptSecretWithPublicKey(publicKey *github.PublicKey, secretName string, secretValue string) (*github.EncryptedSecret, error) {
func encryptSecretWithPublicKey(publicKey *github.PublicKey, secretName, secretValue string) (*github.EncryptedSecret, error) {
decodedPublicKey, err := base64.StdEncoding.DecodeString(publicKey.GetKey())
if err != nil {
return nil, fmt.Errorf("base64.StdEncoding.DecodeString was unable to decode public key: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion github/actions_workflow_runs.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (s *ActionsService) GetWorkflowRunAttempt(ctx context.Context, owner, repo
// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-attempt-logs
//
//meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs
func (s *ActionsService) GetWorkflowRunAttemptLogs(ctx context.Context, owner, repo string, runID int64, attemptNumber int, maxRedirects int) (*url.URL, *Response, error) {
func (s *ActionsService) GetWorkflowRunAttemptLogs(ctx context.Context, owner, repo string, runID int64, attemptNumber, maxRedirects int) (*url.URL, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/attempts/%v/logs", owner, repo, runID, attemptNumber)

if s.client.RateLimitRedirectionalEndpoints {
Expand Down
4 changes: 2 additions & 2 deletions github/git_blobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Blob struct {
// GitHub API docs: https://docs.github.com/rest/git/blobs#get-a-blob
//
//meta:operation GET /repos/{owner}/{repo}/git/blobs/{file_sha}
func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha string) (*Blob, *Response, error) {
func (s *GitService) GetBlob(ctx context.Context, owner, repo, sha string) (*Blob, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
Expand Down Expand Up @@ -71,7 +71,7 @@ func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([
// GitHub API docs: https://docs.github.com/rest/git/blobs#create-a-blob
//
//meta:operation POST /repos/{owner}/{repo}/git/blobs
func (s *GitService) CreateBlob(ctx context.Context, owner string, repo string, blob *Blob) (*Blob, *Response, error) {
func (s *GitService) CreateBlob(ctx context.Context, owner, repo string, blob *Blob) (*Blob, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/git/blobs", owner, repo)
req, err := s.client.NewRequest("POST", u, blob)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions github/git_commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (c CommitAuthor) String() string {
// GitHub API docs: https://docs.github.com/rest/git/commits#get-a-commit-object
//
//meta:operation GET /repos/{owner}/{repo}/git/commits/{commit_sha}
func (s *GitService) GetCommit(ctx context.Context, owner string, repo string, sha string) (*Commit, *Response, error) {
func (s *GitService) GetCommit(ctx context.Context, owner, repo, sha string) (*Commit, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/git/commits/%v", owner, repo, sha)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
Expand Down Expand Up @@ -126,7 +126,7 @@ type CreateCommitOptions struct {
// GitHub API docs: https://docs.github.com/rest/git/commits#create-a-commit
//
//meta:operation POST /repos/{owner}/{repo}/git/commits
func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string, commit *Commit, opts *CreateCommitOptions) (*Commit, *Response, error) {
func (s *GitService) CreateCommit(ctx context.Context, owner, repo string, commit *Commit, opts *CreateCommitOptions) (*Commit, *Response, error) {
if commit == nil {
return nil, nil, errors.New("commit must be provided")
}
Expand Down
8 changes: 4 additions & 4 deletions github/git_refs.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type updateRefRequest struct {
// GitHub API docs: https://docs.github.com/rest/git/refs#get-a-reference
//
//meta:operation GET /repos/{owner}/{repo}/git/ref/{ref}
func (s *GitService) GetRef(ctx context.Context, owner string, repo string, ref string) (*Reference, *Response, error) {
func (s *GitService) GetRef(ctx context.Context, owner, repo, ref string) (*Reference, *Response, error) {
ref = strings.TrimPrefix(ref, "refs/")
u := fmt.Sprintf("repos/%v/%v/git/ref/%v", owner, repo, refURLEscape(ref))
req, err := s.client.NewRequest("GET", u, nil)
Expand Down Expand Up @@ -127,7 +127,7 @@ func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo string, o
// GitHub API docs: https://docs.github.com/rest/git/refs#create-a-reference
//
//meta:operation POST /repos/{owner}/{repo}/git/refs
func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, ref *Reference) (*Reference, *Response, error) {
func (s *GitService) CreateRef(ctx context.Context, owner, repo string, ref *Reference) (*Reference, *Response, error) {
if ref == nil {
return nil, nil, errors.New("reference must be provided")
}
Expand Down Expand Up @@ -159,7 +159,7 @@ func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, r
// GitHub API docs: https://docs.github.com/rest/git/refs#update-a-reference
//
//meta:operation PATCH /repos/{owner}/{repo}/git/refs/{ref}
func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, ref *Reference, force bool) (*Reference, *Response, error) {
func (s *GitService) UpdateRef(ctx context.Context, owner, repo string, ref *Reference, force bool) (*Reference, *Response, error) {
if ref == nil {
return nil, nil, errors.New("reference must be provided")
}
Expand Down Expand Up @@ -191,7 +191,7 @@ func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, r
// GitHub API docs: https://docs.github.com/rest/git/refs#delete-a-reference
//
//meta:operation DELETE /repos/{owner}/{repo}/git/refs/{ref}
func (s *GitService) DeleteRef(ctx context.Context, owner string, repo string, ref string) (*Response, error) {
func (s *GitService) DeleteRef(ctx context.Context, owner, repo, ref string) (*Response, error) {
ref = strings.TrimPrefix(ref, "refs/")
u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refURLEscape(ref))
req, err := s.client.NewRequest("DELETE", u, nil)
Expand Down
4 changes: 2 additions & 2 deletions github/git_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type createTagRequest struct {
// GitHub API docs: https://docs.github.com/rest/git/tags#get-a-tag
//
//meta:operation GET /repos/{owner}/{repo}/git/tags/{tag_sha}
func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha string) (*Tag, *Response, error) {
func (s *GitService) GetTag(ctx context.Context, owner, repo, sha string) (*Tag, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/git/tags/%v", owner, repo, sha)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
Expand All @@ -60,7 +60,7 @@ func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha
// GitHub API docs: https://docs.github.com/rest/git/tags#create-a-tag-object
//
//meta:operation POST /repos/{owner}/{repo}/git/tags
func (s *GitService) CreateTag(ctx context.Context, owner string, repo string, tag *Tag) (*Tag, *Response, error) {
func (s *GitService) CreateTag(ctx context.Context, owner, repo string, tag *Tag) (*Tag, *Response, error) {
if tag == nil {
return nil, nil, errors.New("tag must be provided")
}
Expand Down
4 changes: 2 additions & 2 deletions github/git_trees.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (t *TreeEntry) MarshalJSON() ([]byte, error) {
// GitHub API docs: https://docs.github.com/rest/git/trees#get-a-tree
//
//meta:operation GET /repos/{owner}/{repo}/git/trees/{tree_sha}
func (s *GitService) GetTree(ctx context.Context, owner string, repo string, sha string, recursive bool) (*Tree, *Response, error) {
func (s *GitService) GetTree(ctx context.Context, owner, repo, sha string, recursive bool) (*Tree, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/git/trees/%v", owner, repo, sha)
if recursive {
u += "?recursive=1"
Expand Down Expand Up @@ -129,7 +129,7 @@ type createTree struct {
// GitHub API docs: https://docs.github.com/rest/git/trees#create-a-tree
//
//meta:operation POST /repos/{owner}/{repo}/git/trees
func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []*TreeEntry) (*Tree, *Response, error) {
func (s *GitService) CreateTree(ctx context.Context, owner, repo, baseTree string, entries []*TreeEntry) (*Tree, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/git/trees", owner, repo)

newEntries := make([]any, 0, len(entries))
Expand Down
2 changes: 1 addition & 1 deletion github/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func testFormValues(t *testing.T, r *http.Request, values values) {
}
}

func testHeader(t *testing.T, r *http.Request, header string, want string) {
func testHeader(t *testing.T, r *http.Request, header, want string) {
t.Helper()
if got := r.Header.Get(header); got != want {
t.Errorf("Header.Get(%q) returned %q, want %q", header, got, want)
Expand Down
12 changes: 6 additions & 6 deletions github/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ type IssueListByRepoOptions struct {
// GitHub API docs: https://docs.github.com/rest/issues/issues#list-repository-issues
//
//meta:operation GET /repos/{owner}/{repo}/issues
func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo string, opts *IssueListByRepoOptions) ([]*Issue, *Response, error) {
func (s *IssuesService) ListByRepo(ctx context.Context, owner, repo string, opts *IssueListByRepoOptions) ([]*Issue, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues", owner, repo)
u, err := addOptions(u, opts)
if err != nil {
Expand Down Expand Up @@ -279,7 +279,7 @@ func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo strin
// GitHub API docs: https://docs.github.com/rest/issues/issues#get-an-issue
//
//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}
func (s *IssuesService) Get(ctx context.Context, owner string, repo string, number int) (*Issue, *Response, error) {
func (s *IssuesService) Get(ctx context.Context, owner, repo string, number int) (*Issue, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
Expand All @@ -303,7 +303,7 @@ func (s *IssuesService) Get(ctx context.Context, owner string, repo string, numb
// GitHub API docs: https://docs.github.com/rest/issues/issues#create-an-issue
//
//meta:operation POST /repos/{owner}/{repo}/issues
func (s *IssuesService) Create(ctx context.Context, owner string, repo string, issue *IssueRequest) (*Issue, *Response, error) {
func (s *IssuesService) Create(ctx context.Context, owner, repo string, issue *IssueRequest) (*Issue, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues", owner, repo)
req, err := s.client.NewRequest("POST", u, issue)
if err != nil {
Expand All @@ -324,7 +324,7 @@ func (s *IssuesService) Create(ctx context.Context, owner string, repo string, i
// GitHub API docs: https://docs.github.com/rest/issues/issues#update-an-issue
//
//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number}
func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, number int, issue *IssueRequest) (*Issue, *Response, error) {
func (s *IssuesService) Edit(ctx context.Context, owner, repo string, number int, issue *IssueRequest) (*Issue, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number)
req, err := s.client.NewRequest("PATCH", u, issue)
if err != nil {
Expand Down Expand Up @@ -379,7 +379,7 @@ type LockIssueOptions struct {
// GitHub API docs: https://docs.github.com/rest/issues/issues#lock-an-issue
//
//meta:operation PUT /repos/{owner}/{repo}/issues/{issue_number}/lock
func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, number int, opts *LockIssueOptions) (*Response, error) {
func (s *IssuesService) Lock(ctx context.Context, owner, repo string, number int, opts *LockIssueOptions) (*Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number)
req, err := s.client.NewRequest("PUT", u, opts)
if err != nil {
Expand All @@ -394,7 +394,7 @@ func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, num
// GitHub API docs: https://docs.github.com/rest/issues/issues#unlock-an-issue
//
//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock
func (s *IssuesService) Unlock(ctx context.Context, owner string, repo string, number int) (*Response, error) {
func (s *IssuesService) Unlock(ctx context.Context, owner, repo string, number int) (*Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number)
req, err := s.client.NewRequest("DELETE", u, nil)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions github/issues_comments.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type IssueListCommentsOptions struct {
//
//meta:operation GET /repos/{owner}/{repo}/issues/comments
//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/comments
func (s *IssuesService) ListComments(ctx context.Context, owner string, repo string, number int, opts *IssueListCommentsOptions) ([]*IssueComment, *Response, error) {
func (s *IssuesService) ListComments(ctx context.Context, owner, repo string, number int, opts *IssueListCommentsOptions) ([]*IssueComment, *Response, error) {
var u string
if number == 0 {
u = fmt.Sprintf("repos/%v/%v/issues/comments", owner, repo)
Expand Down Expand Up @@ -89,7 +89,7 @@ func (s *IssuesService) ListComments(ctx context.Context, owner string, repo str
// GitHub API docs: https://docs.github.com/rest/issues/comments#get-an-issue-comment
//
//meta:operation GET /repos/{owner}/{repo}/issues/comments/{comment_id}
func (s *IssuesService) GetComment(ctx context.Context, owner string, repo string, commentID int64) (*IssueComment, *Response, error) {
func (s *IssuesService) GetComment(ctx context.Context, owner, repo string, commentID int64) (*IssueComment, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID)

req, err := s.client.NewRequest("GET", u, nil)
Expand All @@ -114,7 +114,7 @@ func (s *IssuesService) GetComment(ctx context.Context, owner string, repo strin
// GitHub API docs: https://docs.github.com/rest/issues/comments#create-an-issue-comment
//
//meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/comments
func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo string, number int, comment *IssueComment) (*IssueComment, *Response, error) {
func (s *IssuesService) CreateComment(ctx context.Context, owner, repo string, number int, comment *IssueComment) (*IssueComment, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues/%d/comments", owner, repo, number)
req, err := s.client.NewRequest("POST", u, comment)
if err != nil {
Expand All @@ -135,7 +135,7 @@ func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo st
// GitHub API docs: https://docs.github.com/rest/issues/comments#update-an-issue-comment
//
//meta:operation PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}
func (s *IssuesService) EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *IssueComment) (*IssueComment, *Response, error) {
func (s *IssuesService) EditComment(ctx context.Context, owner, repo string, commentID int64, comment *IssueComment) (*IssueComment, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID)
req, err := s.client.NewRequest("PATCH", u, comment)
if err != nil {
Expand All @@ -155,7 +155,7 @@ func (s *IssuesService) EditComment(ctx context.Context, owner string, repo stri
// GitHub API docs: https://docs.github.com/rest/issues/comments#delete-an-issue-comment
//
//meta:operation DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}
func (s *IssuesService) DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*Response, error) {
func (s *IssuesService) DeleteComment(ctx context.Context, owner, repo string, commentID int64) (*Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID)
req, err := s.client.NewRequest("DELETE", u, nil)
if err != nil {
Expand Down
Loading
Loading