Skip to content
Open
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
2 changes: 2 additions & 0 deletions .custom-gcl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ plugins:
path: ./tools/fmtpercentv
- module: "github.com/google/go-github/v88/tools/redundantptr"
path: ./tools/redundantptr
- module: "github.com/google/go-github/v88/tools/requestbody"
path: ./tools/requestbody
- module: "github.com/google/go-github/v88/tools/sliceofpointers"
path: ./tools/sliceofpointers
- module: "github.com/google/go-github/v88/tools/structfield"
Expand Down
131 changes: 131 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ linters:
- paralleltest
- perfsprint
- redundantptr
- requestbody
- revive
- sliceofpointers
- staticcheck
Expand Down Expand Up @@ -198,6 +199,134 @@ linters:
type: module
description: Reports github.Ptr(x) calls that can be replaced with &x.
original-url: github.com/google/go-github/v88/tools/redundantptr
requestbody:
type: module
description: Reports miscellaneous issues for request body parameters.
original-url: github.com/google/go-github/v88/tools/requestbody
settings:
# Body type names exempt from the "pass by value, not by pointer" rule.
# TODO: fix and remove these exceptions.
allowed-pointer-types:
- ActionsVariable
- AddProjectItemOptions
- AuthorizationRequest
- AutolinkOptions
- CodeScanningAlertState
- CodespaceCreateForUserOptions
- ConfigApplyOptions
- ConfigSettings
- CreateCodespaceOptions
- CreateOrUpdateCustomRepoRoleOptions
- CreateOrUpdateIssueTypesOptions
- CreateOrgInvitationOptions
- CreateUpdateEnvironment
- CreateWorkflowDispatchEventRequest
- CustomDeploymentProtectionRuleRequest
- CustomProperty
- DependabotAlertState
- DependabotEncryptedSecret
- DependencyGraphSnapshot
- DeploymentBranchPolicyRequest
- DeploymentRequest
- DeploymentStatusRequest
- EncryptedSecret
- EnterpriseSecurityAnalysisSettings
- ExternalGroup
- GenerateJITConfigRequest
- GenerateNotesOptions
- Gist
- GistComment
- Hook
- HookConfig
- ImpersonateUserOptions
- Import
- InstallationTokenListRepoOptions
- InstallationTokenOptions
- IssueComment
- IssueImportRequest
- IssueRequest
- Key
- Label
- LockIssueOptions
- MaintenanceOptions
- Milestone
- NewPullRequest
- OIDCSubjectClaimCustomTemplate
- Organization
- PagesUpdate
- PagesUpdateWithoutCNAME
- PendingDeploymentsRequest
- PreReceiveHook
- ProtectionRequest
- PublishCodespaceOptions
- PullRequestBranchUpdateOptions
- PullRequestComment
- PullRequestReviewDismissalRequest
- PullRequestReviewRequest
- PullRequestReviewsEnforcementUpdate
- ReleaseAsset
- RepoMergeUpstreamRequest
- Repository
- RepositoryAddCollaboratorOptions
- RepositoryComment
- RepositoryContentFileOptions
- RepositoryCreateForkOptions
- RepositoryMergeRequest
- RequiredStatusChecksRequest
- ReviewCustomDeploymentProtectionRuleRequest
- SCIMUserAttributes
- SarifAnalysis
- SecretScanningAlertUpdateOptions
- SecretScanningPatternConfigsUpdateOptions
- SourceImportAuthor
- Subscription
- TeamAddTeamMembershipOptions
- TeamAddTeamRepoOptions
- TeamLDAPMapping
- TeamProjectOptions
- TemplateRepoRequest
- UpdateCodespaceOptions
- UpdateDefaultSetupConfigurationOptions
- UpdateProjectItemOptions
- User
- UserLDAPMapping
- UserSuspendOptions
- WorkflowsPermissionsOpt
# Body type names exempt from the "Options" suffix rule.
# TODO: fix and remove these exceptions.
allowed-wrong-names:
- AddProjectItemOptions
- AutolinkOptions
- CheckSuitePreferenceOptions
- CodespaceCreateForUserOptions
- ConfigApplyOptions
- CreateCheckRunOptions
- CreateCheckSuiteOptions
- CreateCodespaceOptions
- CreateOrUpdateCustomRepoRoleOptions
- CreateOrUpdateIssueTypesOptions
- CreateOrgInvitationOptions
- GenerateNotesOptions
- ImpersonateUserOptions
- InstallationTokenListRepoOptions
- InstallationTokenOptions
- LockIssueOptions
- MaintenanceOptions
- PublishCodespaceOptions
- PullRequestBranchUpdateOptions
- RepositoryAddCollaboratorOptions
- RepositoryContentFileOptions
- RepositoryCreateForkOptions
- SecretScanningAlertUpdateOptions
- SecretScanningPatternConfigsUpdateOptions
- TeamAddTeamMembershipOptions
- TeamAddTeamRepoOptions
- TeamProjectOptions
- UpdateCheckRunOptions
- UpdateCodespaceOptions
- UpdateDefaultSetupConfigurationOptions
- UpdateProjectItemOptions
- UserSuspendOptions
sliceofpointers:
type: module
description: Reports usage of []*string and slices of structs without pointers.
Expand Down Expand Up @@ -436,6 +565,8 @@ linters:
issues:
max-issues-per-linter: 0
max-same-issues: 0
# requestbody reports multiple distinct issues on the same parameter line.
uniq-by-line: false
formatters:
enable:
- gci
Expand Down
10 changes: 5 additions & 5 deletions github/actions_hosted_runners.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ func validateCreateHostedRunnerRequest(request *CreateHostedRunnerRequest) error
// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#create-a-github-hosted-runner-for-an-organization
//
//meta:operation POST /orgs/{org}/actions/hosted-runners
func (s *ActionsService) CreateHostedRunner(ctx context.Context, org string, request CreateHostedRunnerRequest) (*HostedRunner, *Response, error) {
if err := validateCreateHostedRunnerRequest(&request); err != nil {
func (s *ActionsService) CreateHostedRunner(ctx context.Context, org string, body CreateHostedRunnerRequest) (*HostedRunner, *Response, error) {
if err := validateCreateHostedRunnerRequest(&body); err != nil {
return nil, nil, fmt.Errorf("validation failed: %w", err)
}

u := fmt.Sprintf("orgs/%v/actions/hosted-runners", org)
req, err := s.client.NewRequest(ctx, "POST", u, request)
req, err := s.client.NewRequest(ctx, "POST", u, body)
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -362,9 +362,9 @@ func (s *ActionsService) GetHostedRunner(ctx context.Context, org string, runner
// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#update-a-github-hosted-runner-for-an-organization
//
//meta:operation PATCH /orgs/{org}/actions/hosted-runners/{hosted_runner_id}
func (s *ActionsService) UpdateHostedRunner(ctx context.Context, org string, runnerID int64, request UpdateHostedRunnerRequest) (*HostedRunner, *Response, error) {
func (s *ActionsService) UpdateHostedRunner(ctx context.Context, org string, runnerID int64, body UpdateHostedRunnerRequest) (*HostedRunner, *Response, error) {
u := fmt.Sprintf("orgs/%v/actions/hosted-runners/%v", org, runnerID)
req, err := s.client.NewRequest(ctx, "PATCH", u, request)
req, err := s.client.NewRequest(ctx, "PATCH", u, body)
if err != nil {
return nil, nil, err
}
Expand Down
8 changes: 4 additions & 4 deletions github/actions_oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func (s *ActionsService) getOIDCSubjectClaimCustomTemplate(ctx context.Context,
// GitHub API docs: https://docs.github.com/rest/actions/oidc?apiVersion=2022-11-28#set-the-customization-template-for-an-oidc-subject-claim-for-an-organization
//
//meta:operation PUT /orgs/{org}/actions/oidc/customization/sub
func (s *ActionsService) SetOrgOIDCSubjectClaimCustomTemplate(ctx context.Context, org string, template *OIDCSubjectClaimCustomTemplate) (*Response, error) {
func (s *ActionsService) SetOrgOIDCSubjectClaimCustomTemplate(ctx context.Context, org string, body *OIDCSubjectClaimCustomTemplate) (*Response, error) {
u := fmt.Sprintf("orgs/%v/actions/oidc/customization/sub", org)
return s.setOIDCSubjectClaimCustomTemplate(ctx, u, template)
return s.setOIDCSubjectClaimCustomTemplate(ctx, u, body)
}

// SetRepoOIDCSubjectClaimCustomTemplate sets the subject claim customization for a repository.
Expand All @@ -71,8 +71,8 @@ func (s *ActionsService) SetRepoOIDCSubjectClaimCustomTemplate(ctx context.Conte
return s.setOIDCSubjectClaimCustomTemplate(ctx, u, template)
}

func (s *ActionsService) setOIDCSubjectClaimCustomTemplate(ctx context.Context, url string, template *OIDCSubjectClaimCustomTemplate) (*Response, error) {
req, err := s.client.NewRequest(ctx, "PUT", url, template)
func (s *ActionsService) setOIDCSubjectClaimCustomTemplate(ctx context.Context, url string, body *OIDCSubjectClaimCustomTemplate) (*Response, error) {
req, err := s.client.NewRequest(ctx, "PUT", url, body)
if err != nil {
return nil, err
}
Expand Down
28 changes: 14 additions & 14 deletions github/actions_permissions_enterprise.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ func (s *ActionsService) GetActionsPermissionsInEnterprise(ctx context.Context,
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-github-actions-permissions-for-an-enterprise
//
//meta:operation PUT /enterprises/{enterprise}/actions/permissions
func (s *ActionsService) UpdateActionsPermissionsInEnterprise(ctx context.Context, enterprise string, actionsPermissionsEnterprise ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) {
func (s *ActionsService) UpdateActionsPermissionsInEnterprise(ctx context.Context, enterprise string, body ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) {
u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise)
req, err := s.client.NewRequest(ctx, "PUT", u, actionsPermissionsEnterprise)
req, err := s.client.NewRequest(ctx, "PUT", u, body)
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -207,9 +207,9 @@ func (s *ActionsService) GetActionsAllowedInEnterprise(ctx context.Context, ente
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-allowed-actions-and-reusable-workflows-for-an-enterprise
//
//meta:operation PUT /enterprises/{enterprise}/actions/permissions/selected-actions
func (s *ActionsService) UpdateActionsAllowedInEnterprise(ctx context.Context, enterprise string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) {
func (s *ActionsService) UpdateActionsAllowedInEnterprise(ctx context.Context, enterprise string, body ActionsAllowed) (*ActionsAllowed, *Response, error) {
u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise)
req, err := s.client.NewRequest(ctx, "PUT", u, actionsAllowed)
req, err := s.client.NewRequest(ctx, "PUT", u, body)
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -250,9 +250,9 @@ func (s *ActionsService) GetDefaultWorkflowPermissionsInEnterprise(ctx context.C
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-default-workflow-permissions-for-an-enterprise
//
//meta:operation PUT /enterprises/{enterprise}/actions/permissions/workflow
func (s *ActionsService) UpdateDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string, permissions DefaultWorkflowPermissionEnterprise) (*DefaultWorkflowPermissionEnterprise, *Response, error) {
func (s *ActionsService) UpdateDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string, body DefaultWorkflowPermissionEnterprise) (*DefaultWorkflowPermissionEnterprise, *Response, error) {
u := fmt.Sprintf("enterprises/%v/actions/permissions/workflow", enterprise)
req, err := s.client.NewRequest(ctx, "PUT", u, permissions)
req, err := s.client.NewRequest(ctx, "PUT", u, body)
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -293,9 +293,9 @@ func (s *ActionsService) GetArtifactAndLogRetentionPeriodInEnterprise(ctx contex
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-artifact-and-log-retention-settings-for-an-enterprise
//
//meta:operation PUT /enterprises/{enterprise}/actions/permissions/artifact-and-log-retention
func (s *ActionsService) UpdateArtifactAndLogRetentionPeriodInEnterprise(ctx context.Context, enterprise string, period ArtifactPeriodOpt) (*Response, error) {
func (s *ActionsService) UpdateArtifactAndLogRetentionPeriodInEnterprise(ctx context.Context, enterprise string, body ArtifactPeriodOpt) (*Response, error) {
u := fmt.Sprintf("enterprises/%v/actions/permissions/artifact-and-log-retention", enterprise)
req, err := s.client.NewRequest(ctx, "PUT", u, period)
req, err := s.client.NewRequest(ctx, "PUT", u, body)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -329,9 +329,9 @@ func (s *ActionsService) GetSelfHostedRunnerPermissionsInEnterprise(ctx context.
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-self-hosted-runners-permissions-for-an-enterprise
//
//meta:operation PUT /enterprises/{enterprise}/actions/permissions/self-hosted-runners
func (s *ActionsService) UpdateSelfHostedRunnerPermissionsInEnterprise(ctx context.Context, enterprise string, permissions SelfHostRunnerPermissionsEnterprise) (*Response, error) {
func (s *ActionsService) UpdateSelfHostedRunnerPermissionsInEnterprise(ctx context.Context, enterprise string, body SelfHostRunnerPermissionsEnterprise) (*Response, error) {
u := fmt.Sprintf("enterprises/%v/actions/permissions/self-hosted-runners", enterprise)
req, err := s.client.NewRequest(ctx, "PUT", u, permissions)
req, err := s.client.NewRequest(ctx, "PUT", u, body)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -366,9 +366,9 @@ func (s *ActionsService) GetPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx co
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-private-repo-fork-pr-workflow-settings-for-an-enterprise
//
//meta:operation PUT /enterprises/{enterprise}/actions/permissions/fork-pr-workflows-private-repos
func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string, permissions *WorkflowsPermissionsOpt) (*Response, error) {
func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string, body *WorkflowsPermissionsOpt) (*Response, error) {
u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-workflows-private-repos", enterprise)
req, err := s.client.NewRequest(ctx, "PUT", u, permissions)
req, err := s.client.NewRequest(ctx, "PUT", u, body)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -403,9 +403,9 @@ func (s *ActionsService) GetEnterpriseForkPRContributorApprovalPermissions(ctx c
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-fork-pr-contributor-approval-permissions-for-an-enterprise
//
//meta:operation PUT /enterprises/{enterprise}/actions/permissions/fork-pr-contributor-approval
func (s *ActionsService) UpdateEnterpriseForkPRContributorApprovalPermissions(ctx context.Context, enterprise string, policy ContributorApprovalPermissions) (*Response, error) {
func (s *ActionsService) UpdateEnterpriseForkPRContributorApprovalPermissions(ctx context.Context, enterprise string, body ContributorApprovalPermissions) (*Response, error) {
u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-contributor-approval", enterprise)
req, err := s.client.NewRequest(ctx, "PUT", u, policy)
req, err := s.client.NewRequest(ctx, "PUT", u, body)
if err != nil {
return nil, err
}
Expand Down
Loading
Loading