Skip to content

Commit 2ca80c0

Browse files
authored
refactor!: Pass workflow settings by value (#4679)
BREAKING CHANGE: Callers must use `WorkflowsPermissionsRequest` values instead of `*WorkflowsPermissionsOpt`.
1 parent 143d047 commit 2ca80c0

10 files changed

Lines changed: 24 additions & 24 deletions

‎.golangci.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ linters:
230230
- SourceImportAuthor
231231
- Subscription
232232
- UpdateDefaultSetupConfigurationOptions
233-
- WorkflowsPermissionsOpt
234233
# Body type names exempt from the "Options" suffix rule.
235234
# TODO: fix and remove these exceptions.
236235
body-allowed-wrong-names:

‎github/actions_permissions_enterprise.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ func (s *ActionsService) GetPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx co
366366
// 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
367367
//
368368
//meta:operation PUT /enterprises/{enterprise}/actions/permissions/fork-pr-workflows-private-repos
369-
func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string, body *WorkflowsPermissionsOpt) (*Response, error) {
369+
func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string, body WorkflowsPermissionsRequest) (*Response, error) {
370370
u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-workflows-private-repos", enterprise)
371371
req, err := s.client.NewRequest(ctx, "PUT", u, body)
372372
if err != nil {

‎github/actions_permissions_enterprise_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ func TestActionsService_UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(t *t
543543
t.Parallel()
544544
client, mux, _ := setup(t)
545545

546-
input := &WorkflowsPermissionsOpt{
546+
input := WorkflowsPermissionsRequest{
547547
RunWorkflowsFromForkPullRequests: true,
548548
SendWriteTokensToWorkflows: new(false),
549549
SendSecretsAndVariables: new(true),

‎github/actions_permissions_orgs.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ func (s *ActionsService) GetPrivateRepoForkPRWorkflowSettingsInOrganization(ctx
478478
// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-private-repo-fork-pr-workflow-settings-for-an-organization
479479
//
480480
//meta:operation PUT /orgs/{org}/actions/permissions/fork-pr-workflows-private-repos
481-
func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInOrganization(ctx context.Context, org string, body *WorkflowsPermissionsOpt) (*Response, error) {
481+
func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInOrganization(ctx context.Context, org string, body WorkflowsPermissionsRequest) (*Response, error) {
482482
u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-workflows-private-repos", org)
483483
req, err := s.client.NewRequest(ctx, "PUT", u, body)
484484
if err != nil {

‎github/actions_permissions_orgs_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ func TestActionsService_UpdatePrivateRepoForkPRWorkflowSettingsInOrganization(t
785785
t.Parallel()
786786
client, mux, _ := setup(t)
787787

788-
input := &WorkflowsPermissionsOpt{
788+
input := WorkflowsPermissionsRequest{
789789
RunWorkflowsFromForkPullRequests: true,
790790
SendWriteTokensToWorkflows: new(false),
791791
SendSecretsAndVariables: new(true),

‎github/actions_workflows.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ func (w WorkflowsPermissions) String() string {
7979
return Stringify(w)
8080
}
8181

82-
// WorkflowsPermissionsOpt specifies options for editing workflows permissions in a repository.
83-
type WorkflowsPermissionsOpt struct {
82+
// WorkflowsPermissionsRequest specifies fork pull request workflow settings
83+
// for a repository, organization, or enterprise.
84+
type WorkflowsPermissionsRequest struct {
8485
RunWorkflowsFromForkPullRequests bool `json:"run_workflows_from_fork_pull_requests"`
8586
SendWriteTokensToWorkflows *bool `json:"send_write_tokens_to_workflows,omitempty"`
8687
SendSecretsAndVariables *bool `json:"send_secrets_and_variables,omitempty"`

‎github/github-accessors.go‎

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎github/github-accessors_test.go‎

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎github/repos_actions_permissions.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func (s *RepositoriesService) GetPrivateRepoForkPRWorkflowSettings(ctx context.C
182182
// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-private-repo-fork-pr-workflow-settings-for-a-repository
183183
//
184184
//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/fork-pr-workflows-private-repos
185-
func (s *RepositoriesService) UpdatePrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string, body *WorkflowsPermissionsOpt) (*Response, error) {
185+
func (s *RepositoriesService) UpdatePrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string, body WorkflowsPermissionsRequest) (*Response, error) {
186186
u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-workflows-private-repos", owner, repo)
187187
req, err := s.client.NewRequest(ctx, "PUT", u, body)
188188
if err != nil {

‎github/repos_actions_permissions_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ func TestRepositoriesService_UpdatePrivateRepoForkPRWorkflowSettings(t *testing.
271271
t.Parallel()
272272
client, mux, _ := setup(t)
273273

274-
input := &WorkflowsPermissionsOpt{
274+
input := WorkflowsPermissionsRequest{
275275
RunWorkflowsFromForkPullRequests: true,
276276
SendWriteTokensToWorkflows: new(false),
277277
SendSecretsAndVariables: new(true),

0 commit comments

Comments
 (0)