From 155da3789345b105e2f94de482bafc96dd60d356 Mon Sep 17 00:00:00 2001 From: zyfy29 Date: Fri, 15 Aug 2025 16:16:12 +0900 Subject: [PATCH 1/9] feat: private repo pr work flow apis for enterprises --- github/actions_permissions_enterprise.go | 37 +++++++++ github/actions_permissions_enterprise_test.go | 82 +++++++++++++++++++ github/actions_workflows.go | 8 ++ 3 files changed, 127 insertions(+) diff --git a/github/actions_permissions_enterprise.go b/github/actions_permissions_enterprise.go index 1334690f474..8177f2d63e8 100644 --- a/github/actions_permissions_enterprise.go +++ b/github/actions_permissions_enterprise.go @@ -338,3 +338,40 @@ func (s *ActionsService) EditSelfHostedRunnerPermissionsInEnterprise(ctx context return s.client.Do(ctx, req, nil) } + +// GetPrivateRepoForkPRWorkflowSettingsInEnterprise gets the settings for whether workflows from fork pull requests can run on private repositories in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-private-repo-fork-pr-workflow-settings-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/fork-pr-workflows-private-repos +func (s *ActionsService) GetPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string) (*WorkflowsPermissions, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-workflows-private-repos", enterprise) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + permissions := new(WorkflowsPermissions) + resp, err := s.client.Do(ctx, req, permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// EditPrivateRepoForkPRWorkflowSettingsInEnterprise sets the settings for whether workflows from fork pull requests can run on private repositories in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#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) EditPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string, permissions WorkflowsPermissions) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-workflows-private-repos", enterprise) + req, err := s.client.NewRequest("PUT", u, permissions) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/github/actions_permissions_enterprise_test.go b/github/actions_permissions_enterprise_test.go index 0a5cb22684f..83eb49035e4 100644 --- a/github/actions_permissions_enterprise_test.go +++ b/github/actions_permissions_enterprise_test.go @@ -523,3 +523,85 @@ func TestActionsService_EditSelfHostedRunnerPermissionsInEnterprise(t *testing.T return client.Actions.EditSelfHostedRunnerPermissionsInEnterprise(ctx, "e", *input) }) } + +func TestActionsService_GetPrivateRepoForkPRWorkflowSettingsInEnterprise(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + + mux.HandleFunc("/enterprises/e/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"run_workflows_from_fork_pull_requests": true, "send_write_tokens_to_workflows": false, "send_secrets_and_variables": true, "require_approval_for_fork_pr_workflows": false}`) + }) + + ctx := context.Background() + permissions, _, err := client.Actions.GetPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "e") + if err != nil { + t.Errorf("Actions.GetPrivateRepoForkPRWorkflowSettingsInEnterprise returned error: %v", err) + } + want := &WorkflowsPermissions{ + RunWorkflowsFromForkPullRequests: true, + SendWriteTokensToWorkflows: false, + SendSecretsAndVariables: true, + RequireApprovalForForkPrWorkflows: false, + } + if !cmp.Equal(permissions, want) { + t.Errorf("Actions.GetPrivateRepoForkPRWorkflowSettingsInEnterprise returned %+v, want %+v", permissions, want) + } + + const methodName = "GetPrivateRepoForkPRWorkflowSettingsInEnterprise" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.GetPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.GetPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "e") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestActionsService_EditPrivateRepoForkPRWorkflowSettingsInEnterprise(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + + input := &WorkflowsPermissions{ + RunWorkflowsFromForkPullRequests: true, + SendWriteTokensToWorkflows: false, + SendSecretsAndVariables: true, + RequireApprovalForForkPrWorkflows: false, + } + + mux.HandleFunc("/enterprises/e/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { + v := new(WorkflowsPermissions) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + + testMethod(t, r, "PUT") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + resp, err := client.Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "e", *input) + if err != nil { + t.Errorf("Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise returned error: %v", err) + } + + if resp.StatusCode != http.StatusNoContent { + t.Errorf("Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise = %d, want %d", resp.StatusCode, http.StatusNoContent) + } + + const methodName = "EditPrivateRepoForkPRWorkflowSettingsInEnterprise" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "\n", *input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "e", *input) + }) +} diff --git a/github/actions_workflows.go b/github/actions_workflows.go index 4d9df69eb0d..4d553202d79 100644 --- a/github/actions_workflows.go +++ b/github/actions_workflows.go @@ -56,6 +56,14 @@ type CreateWorkflowDispatchEventRequest struct { Inputs map[string]any `json:"inputs,omitempty"` } +// WorkflowsPermissions represents the permissions for workflows in a repository. +type WorkflowsPermissions struct { + RunWorkflowsFromForkPullRequests bool `json:"run_workflows_from_fork_pull_requests"` + SendWriteTokensToWorkflows bool `json:"send_write_tokens_to_workflows"` + SendSecretsAndVariables bool `json:"send_secrets_and_variables"` + RequireApprovalForForkPrWorkflows bool `json:"require_approval_for_fork_pr_workflows"` +} + // ListWorkflows lists all workflows in a repository. // // GitHub API docs: https://docs.github.com/rest/actions/workflows#list-repository-workflows From 8ec23fb2104ad9650c466c6fdbc9544e613c06dc Mon Sep 17 00:00:00 2001 From: zyfy29 Date: Fri, 15 Aug 2025 16:25:23 +0900 Subject: [PATCH 2/9] feat: private repo pr work flow apis for organization --- github/actions_permissions_orgs.go | 37 +++++++++++ github/actions_permissions_orgs_test.go | 82 +++++++++++++++++++++++++ 2 files changed, 119 insertions(+) diff --git a/github/actions_permissions_orgs.go b/github/actions_permissions_orgs.go index f8bd51a08aa..7c0ac2bf1ef 100644 --- a/github/actions_permissions_orgs.go +++ b/github/actions_permissions_orgs.go @@ -446,3 +446,40 @@ func (s *ActionsService) RemoveRepositorySelfHostedRunnersAllowedInOrganization( return resp, nil } + +// GetPrivateRepoForkPRWorkflowSettingsInOrganization gets the settings for whether workflows from fork pull requests can run on private repositories in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-private-repo-fork-pr-workflow-settings-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/fork-pr-workflows-private-repos +func (s *ActionsService) GetPrivateRepoForkPRWorkflowSettingsInOrganization(ctx context.Context, org string) (*WorkflowsPermissions, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-workflows-private-repos", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + permissions := new(WorkflowsPermissions) + resp, err := s.client.Do(ctx, req, permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// EditPrivateRepoForkPRWorkflowSettingsInOrganization sets the settings for whether workflows from fork pull requests can run on private repositories in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-private-repo-fork-pr-workflow-settings-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/fork-pr-workflows-private-repos +func (s *ActionsService) EditPrivateRepoForkPRWorkflowSettingsInOrganization(ctx context.Context, org string, permissions WorkflowsPermissions) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-workflows-private-repos", org) + req, err := s.client.NewRequest("PUT", u, permissions) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/github/actions_permissions_orgs_test.go b/github/actions_permissions_orgs_test.go index dbe7eb3a8d7..f163f98d8b2 100644 --- a/github/actions_permissions_orgs_test.go +++ b/github/actions_permissions_orgs_test.go @@ -693,3 +693,85 @@ func TestActionsService_RemoveRepositorySelfHostedRunnersAllowedInOrganization(t return client.Actions.RemoveRepositorySelfHostedRunnersAllowedInOrganization(ctx, "o", 123) }) } + +func TestActionsService_GetPrivateRepoForkPRWorkflowSettingsInOrganization(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + + mux.HandleFunc("/orgs/o/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"run_workflows_from_fork_pull_requests": true, "send_write_tokens_to_workflows": false, "send_secrets_and_variables": true, "require_approval_for_fork_pr_workflows": false}`) + }) + + ctx := context.Background() + permissions, _, err := client.Actions.GetPrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "o") + if err != nil { + t.Errorf("Actions.GetPrivateRepoForkPRWorkflowSettingsInOrganization returned error: %v", err) + } + want := &WorkflowsPermissions{ + RunWorkflowsFromForkPullRequests: true, + SendWriteTokensToWorkflows: false, + SendSecretsAndVariables: true, + RequireApprovalForForkPrWorkflows: false, + } + if !cmp.Equal(permissions, want) { + t.Errorf("Actions.GetPrivateRepoForkPRWorkflowSettingsInOrganization returned %+v, want %+v", permissions, want) + } + + const methodName = "GetPrivateRepoForkPRWorkflowSettingsInOrganization" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.GetPrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.GetPrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "o") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestActionsService_EditPrivateRepoForkPRWorkflowSettingsInOrganization(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + + input := &WorkflowsPermissions{ + RunWorkflowsFromForkPullRequests: true, + SendWriteTokensToWorkflows: false, + SendSecretsAndVariables: true, + RequireApprovalForForkPrWorkflows: false, + } + + mux.HandleFunc("/orgs/o/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { + v := new(WorkflowsPermissions) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + + testMethod(t, r, "PUT") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + resp, err := client.Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "o", *input) + if err != nil { + t.Errorf("Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization returned error: %v", err) + } + + if resp.StatusCode != http.StatusNoContent { + t.Errorf("Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization = %d, want %d", resp.StatusCode, http.StatusNoContent) + } + + const methodName = "EditPrivateRepoForkPRWorkflowSettingsInOrganization" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "\n", *input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "o", *input) + }) +} From 7e85478f5b7dd0932ddc243828a62004b95ff6af Mon Sep 17 00:00:00 2001 From: zyfy29 Date: Fri, 15 Aug 2025 16:28:43 +0900 Subject: [PATCH 3/9] feat: private repo pr work flow apis for private repositories --- github/repos_actions_permissions.go | 37 +++++++++++ github/repos_actions_permissions_test.go | 82 ++++++++++++++++++++++++ 2 files changed, 119 insertions(+) diff --git a/github/repos_actions_permissions.go b/github/repos_actions_permissions.go index 4992e503371..55392e8968d 100644 --- a/github/repos_actions_permissions.go +++ b/github/repos_actions_permissions.go @@ -153,3 +153,40 @@ func (s *RepositoriesService) EditArtifactAndLogRetentionPeriod(ctx context.Cont return s.client.Do(ctx, req, nil) } + +// GetPrivateRepoForkPRWorkflowSettings gets the settings for whether workflows from fork pull requests can run on a private repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-private-repo-fork-pr-workflow-settings-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/permissions/fork-pr-workflows-private-repos +func (s *RepositoriesService) GetPrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string) (*WorkflowsPermissions, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-workflows-private-repos", owner, repo) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + permissions := new(WorkflowsPermissions) + resp, err := s.client.Do(ctx, req, permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// EditPrivateRepoForkPRWorkflowSettings sets the settings for whether workflows from fork pull requests can run on a private repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-private-repo-fork-pr-workflow-settings-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/fork-pr-workflows-private-repos +func (s *RepositoriesService) EditPrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string, permissions WorkflowsPermissions) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-workflows-private-repos", owner, repo) + req, err := s.client.NewRequest("PUT", u, permissions) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/github/repos_actions_permissions_test.go b/github/repos_actions_permissions_test.go index d498023356e..2b68233f42c 100644 --- a/github/repos_actions_permissions_test.go +++ b/github/repos_actions_permissions_test.go @@ -265,3 +265,85 @@ func TestRepositoriesService_EditArtifactAndLogRetentionPeriod(t *testing.T) { return client.Repositories.EditArtifactAndLogRetentionPeriod(ctx, "o", "r", *input) }) } + +func TestRepositoriesService_GetPrivateRepoForkPRWorkflowSettings(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + + mux.HandleFunc("/repos/o/r/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"run_workflows_from_fork_pull_requests": true, "send_write_tokens_to_workflows": false, "send_secrets_and_variables": true, "require_approval_for_fork_pr_workflows": false}`) + }) + + ctx := context.Background() + permissions, _, err := client.Repositories.GetPrivateRepoForkPRWorkflowSettings(ctx, "o", "r") + if err != nil { + t.Errorf("Repositories.GetPrivateRepoForkPRWorkflowSettings returned error: %v", err) + } + want := &WorkflowsPermissions{ + RunWorkflowsFromForkPullRequests: true, + SendWriteTokensToWorkflows: false, + SendSecretsAndVariables: true, + RequireApprovalForForkPrWorkflows: false, + } + if !cmp.Equal(permissions, want) { + t.Errorf("Repositories.GetPrivateRepoForkPRWorkflowSettings returned %+v, want %+v", permissions, want) + } + + const methodName = "GetPrivateRepoForkPRWorkflowSettings" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.GetPrivateRepoForkPRWorkflowSettings(ctx, "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.GetPrivateRepoForkPRWorkflowSettings(ctx, "o", "r") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestRepositoriesService_EditPrivateRepoForkPRWorkflowSettings(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + + input := &WorkflowsPermissions{ + RunWorkflowsFromForkPullRequests: true, + SendWriteTokensToWorkflows: false, + SendSecretsAndVariables: true, + RequireApprovalForForkPrWorkflows: false, + } + + mux.HandleFunc("/repos/o/r/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { + v := new(WorkflowsPermissions) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + + testMethod(t, r, "PUT") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + resp, err := client.Repositories.EditPrivateRepoForkPRWorkflowSettings(ctx, "o", "r", *input) + if err != nil { + t.Errorf("Repositories.EditPrivateRepoForkPRWorkflowSettings returned error: %v", err) + } + + if resp.StatusCode != http.StatusNoContent { + t.Errorf("Repositories.EditPrivateRepoForkPRWorkflowSettings = %d, want %d", resp.StatusCode, http.StatusNoContent) + } + + const methodName = "EditPrivateRepoForkPRWorkflowSettings" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Repositories.EditPrivateRepoForkPRWorkflowSettings(ctx, "\n", "\n", *input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Repositories.EditPrivateRepoForkPRWorkflowSettings(ctx, "o", "r", *input) + }) +} From 053462c5e26e0e1fa7f72d1ce7edb7abb7bb8f9c Mon Sep 17 00:00:00 2001 From: zyfy29 Date: Fri, 15 Aug 2025 16:30:08 +0900 Subject: [PATCH 4/9] feat: Add String method to WorkflowsPermissions for better string representation --- github/actions_workflows.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/github/actions_workflows.go b/github/actions_workflows.go index 4d553202d79..b38117fbeb5 100644 --- a/github/actions_workflows.go +++ b/github/actions_workflows.go @@ -64,6 +64,10 @@ type WorkflowsPermissions struct { RequireApprovalForForkPrWorkflows bool `json:"require_approval_for_fork_pr_workflows"` } +func (w WorkflowsPermissions) String() string { + return Stringify(w) +} + // ListWorkflows lists all workflows in a repository. // // GitHub API docs: https://docs.github.com/rest/actions/workflows#list-repository-workflows From a864e950043ad76ea8f2a65a62c32db5d2d33df7 Mon Sep 17 00:00:00 2001 From: zyfy29 Date: Fri, 15 Aug 2025 16:37:04 +0900 Subject: [PATCH 5/9] fix: replace WorkflowsPermissions fields to pointer type --- github/actions_permissions_enterprise_test.go | 16 +++---- github/actions_permissions_orgs_test.go | 16 +++---- github/actions_workflows.go | 8 ++-- github/github-accessors.go | 32 ++++++++++++++ github/github-accessors_test.go | 44 +++++++++++++++++++ github/github-stringify_test.go | 14 ++++++ github/repos_actions_permissions_test.go | 16 +++---- 7 files changed, 118 insertions(+), 28 deletions(-) diff --git a/github/actions_permissions_enterprise_test.go b/github/actions_permissions_enterprise_test.go index 83eb49035e4..adaede0196d 100644 --- a/github/actions_permissions_enterprise_test.go +++ b/github/actions_permissions_enterprise_test.go @@ -539,10 +539,10 @@ func TestActionsService_GetPrivateRepoForkPRWorkflowSettingsInEnterprise(t *test t.Errorf("Actions.GetPrivateRepoForkPRWorkflowSettingsInEnterprise returned error: %v", err) } want := &WorkflowsPermissions{ - RunWorkflowsFromForkPullRequests: true, - SendWriteTokensToWorkflows: false, - SendSecretsAndVariables: true, - RequireApprovalForForkPrWorkflows: false, + RunWorkflowsFromForkPullRequests: Ptr(true), + SendWriteTokensToWorkflows: Ptr(false), + SendSecretsAndVariables: Ptr(true), + RequireApprovalForForkPrWorkflows: Ptr(false), } if !cmp.Equal(permissions, want) { t.Errorf("Actions.GetPrivateRepoForkPRWorkflowSettingsInEnterprise returned %+v, want %+v", permissions, want) @@ -568,10 +568,10 @@ func TestActionsService_EditPrivateRepoForkPRWorkflowSettingsInEnterprise(t *tes client, mux, _ := setup(t) input := &WorkflowsPermissions{ - RunWorkflowsFromForkPullRequests: true, - SendWriteTokensToWorkflows: false, - SendSecretsAndVariables: true, - RequireApprovalForForkPrWorkflows: false, + RunWorkflowsFromForkPullRequests: Ptr(true), + SendWriteTokensToWorkflows: Ptr(false), + SendSecretsAndVariables: Ptr(true), + RequireApprovalForForkPrWorkflows: Ptr(false), } mux.HandleFunc("/enterprises/e/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { diff --git a/github/actions_permissions_orgs_test.go b/github/actions_permissions_orgs_test.go index f163f98d8b2..463aa81cef2 100644 --- a/github/actions_permissions_orgs_test.go +++ b/github/actions_permissions_orgs_test.go @@ -709,10 +709,10 @@ func TestActionsService_GetPrivateRepoForkPRWorkflowSettingsInOrganization(t *te t.Errorf("Actions.GetPrivateRepoForkPRWorkflowSettingsInOrganization returned error: %v", err) } want := &WorkflowsPermissions{ - RunWorkflowsFromForkPullRequests: true, - SendWriteTokensToWorkflows: false, - SendSecretsAndVariables: true, - RequireApprovalForForkPrWorkflows: false, + RunWorkflowsFromForkPullRequests: Ptr(true), + SendWriteTokensToWorkflows: Ptr(false), + SendSecretsAndVariables: Ptr(true), + RequireApprovalForForkPrWorkflows: Ptr(false), } if !cmp.Equal(permissions, want) { t.Errorf("Actions.GetPrivateRepoForkPRWorkflowSettingsInOrganization returned %+v, want %+v", permissions, want) @@ -738,10 +738,10 @@ func TestActionsService_EditPrivateRepoForkPRWorkflowSettingsInOrganization(t *t client, mux, _ := setup(t) input := &WorkflowsPermissions{ - RunWorkflowsFromForkPullRequests: true, - SendWriteTokensToWorkflows: false, - SendSecretsAndVariables: true, - RequireApprovalForForkPrWorkflows: false, + RunWorkflowsFromForkPullRequests: Ptr(true), + SendWriteTokensToWorkflows: Ptr(false), + SendSecretsAndVariables: Ptr(true), + RequireApprovalForForkPrWorkflows: Ptr(false), } mux.HandleFunc("/orgs/o/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { diff --git a/github/actions_workflows.go b/github/actions_workflows.go index b38117fbeb5..3822778d507 100644 --- a/github/actions_workflows.go +++ b/github/actions_workflows.go @@ -58,10 +58,10 @@ type CreateWorkflowDispatchEventRequest struct { // WorkflowsPermissions represents the permissions for workflows in a repository. type WorkflowsPermissions struct { - RunWorkflowsFromForkPullRequests bool `json:"run_workflows_from_fork_pull_requests"` - SendWriteTokensToWorkflows bool `json:"send_write_tokens_to_workflows"` - SendSecretsAndVariables bool `json:"send_secrets_and_variables"` - RequireApprovalForForkPrWorkflows bool `json:"require_approval_for_fork_pr_workflows"` + RunWorkflowsFromForkPullRequests *bool `json:"run_workflows_from_fork_pull_requests,omitempty"` + SendWriteTokensToWorkflows *bool `json:"send_write_tokens_to_workflows,omitempty"` + SendSecretsAndVariables *bool `json:"send_secrets_and_variables,omitempty"` + RequireApprovalForForkPrWorkflows *bool `json:"require_approval_for_fork_pr_workflows,omitempty"` } func (w WorkflowsPermissions) String() string { diff --git a/github/github-accessors.go b/github/github-accessors.go index d0973b280b0..92c767f89fe 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -29974,6 +29974,38 @@ func (w *Workflows) GetTotalCount() int { return *w.TotalCount } +// GetRequireApprovalForForkPrWorkflows returns the RequireApprovalForForkPrWorkflows field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissions) GetRequireApprovalForForkPrWorkflows() bool { + if w == nil || w.RequireApprovalForForkPrWorkflows == nil { + return false + } + return *w.RequireApprovalForForkPrWorkflows +} + +// GetRunWorkflowsFromForkPullRequests returns the RunWorkflowsFromForkPullRequests field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissions) GetRunWorkflowsFromForkPullRequests() bool { + if w == nil || w.RunWorkflowsFromForkPullRequests == nil { + return false + } + return *w.RunWorkflowsFromForkPullRequests +} + +// GetSendSecretsAndVariables returns the SendSecretsAndVariables field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissions) GetSendSecretsAndVariables() bool { + if w == nil || w.SendSecretsAndVariables == nil { + return false + } + return *w.SendSecretsAndVariables +} + +// GetSendWriteTokensToWorkflows returns the SendWriteTokensToWorkflows field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissions) GetSendWriteTokensToWorkflows() bool { + if w == nil || w.SendWriteTokensToWorkflows == nil { + return false + } + return *w.SendWriteTokensToWorkflows +} + // GetDoNotEnforceOnCreate returns the DoNotEnforceOnCreate field if it's non-nil, zero value otherwise. func (w *WorkflowsRuleParameters) GetDoNotEnforceOnCreate() bool { if w == nil || w.DoNotEnforceOnCreate == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index dbc78f046ba..fb3e89a0017 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -38630,6 +38630,50 @@ func TestWorkflows_GetTotalCount(tt *testing.T) { w.GetTotalCount() } +func TestWorkflowsPermissions_GetRequireApprovalForForkPrWorkflows(tt *testing.T) { + tt.Parallel() + var zeroValue bool + w := &WorkflowsPermissions{RequireApprovalForForkPrWorkflows: &zeroValue} + w.GetRequireApprovalForForkPrWorkflows() + w = &WorkflowsPermissions{} + w.GetRequireApprovalForForkPrWorkflows() + w = nil + w.GetRequireApprovalForForkPrWorkflows() +} + +func TestWorkflowsPermissions_GetRunWorkflowsFromForkPullRequests(tt *testing.T) { + tt.Parallel() + var zeroValue bool + w := &WorkflowsPermissions{RunWorkflowsFromForkPullRequests: &zeroValue} + w.GetRunWorkflowsFromForkPullRequests() + w = &WorkflowsPermissions{} + w.GetRunWorkflowsFromForkPullRequests() + w = nil + w.GetRunWorkflowsFromForkPullRequests() +} + +func TestWorkflowsPermissions_GetSendSecretsAndVariables(tt *testing.T) { + tt.Parallel() + var zeroValue bool + w := &WorkflowsPermissions{SendSecretsAndVariables: &zeroValue} + w.GetSendSecretsAndVariables() + w = &WorkflowsPermissions{} + w.GetSendSecretsAndVariables() + w = nil + w.GetSendSecretsAndVariables() +} + +func TestWorkflowsPermissions_GetSendWriteTokensToWorkflows(tt *testing.T) { + tt.Parallel() + var zeroValue bool + w := &WorkflowsPermissions{SendWriteTokensToWorkflows: &zeroValue} + w.GetSendWriteTokensToWorkflows() + w = &WorkflowsPermissions{} + w.GetSendWriteTokensToWorkflows() + w = nil + w.GetSendWriteTokensToWorkflows() +} + func TestWorkflowsRuleParameters_GetDoNotEnforceOnCreate(tt *testing.T) { tt.Parallel() var zeroValue bool diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index abbe7f6b8c0..32ee73ffbb4 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -2338,3 +2338,17 @@ func TestWeeklyStats_String(t *testing.T) { t.Errorf("WeeklyStats.String = %v, want %v", got, want) } } + +func TestWorkflowsPermissions_String(t *testing.T) { + t.Parallel() + v := WorkflowsPermissions{ + RunWorkflowsFromForkPullRequests: Ptr(false), + SendWriteTokensToWorkflows: Ptr(false), + SendSecretsAndVariables: Ptr(false), + RequireApprovalForForkPrWorkflows: Ptr(false), + } + want := `github.WorkflowsPermissions{RunWorkflowsFromForkPullRequests:false, SendWriteTokensToWorkflows:false, SendSecretsAndVariables:false, RequireApprovalForForkPrWorkflows:false}` + if got := v.String(); got != want { + t.Errorf("WorkflowsPermissions.String = %v, want %v", got, want) + } +} diff --git a/github/repos_actions_permissions_test.go b/github/repos_actions_permissions_test.go index 2b68233f42c..4721224639a 100644 --- a/github/repos_actions_permissions_test.go +++ b/github/repos_actions_permissions_test.go @@ -281,10 +281,10 @@ func TestRepositoriesService_GetPrivateRepoForkPRWorkflowSettings(t *testing.T) t.Errorf("Repositories.GetPrivateRepoForkPRWorkflowSettings returned error: %v", err) } want := &WorkflowsPermissions{ - RunWorkflowsFromForkPullRequests: true, - SendWriteTokensToWorkflows: false, - SendSecretsAndVariables: true, - RequireApprovalForForkPrWorkflows: false, + RunWorkflowsFromForkPullRequests: Ptr(true), + SendWriteTokensToWorkflows: Ptr(false), + SendSecretsAndVariables: Ptr(true), + RequireApprovalForForkPrWorkflows: Ptr(false), } if !cmp.Equal(permissions, want) { t.Errorf("Repositories.GetPrivateRepoForkPRWorkflowSettings returned %+v, want %+v", permissions, want) @@ -310,10 +310,10 @@ func TestRepositoriesService_EditPrivateRepoForkPRWorkflowSettings(t *testing.T) client, mux, _ := setup(t) input := &WorkflowsPermissions{ - RunWorkflowsFromForkPullRequests: true, - SendWriteTokensToWorkflows: false, - SendSecretsAndVariables: true, - RequireApprovalForForkPrWorkflows: false, + RunWorkflowsFromForkPullRequests: Ptr(true), + SendWriteTokensToWorkflows: Ptr(false), + SendSecretsAndVariables: Ptr(true), + RequireApprovalForForkPrWorkflows: Ptr(false), } mux.HandleFunc("/repos/o/r/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { From af079dc7923785d8c2d094384ccfea9f7aa5e48d Mon Sep 17 00:00:00 2001 From: zyfy29 Date: Sat, 16 Aug 2025 07:12:53 +0900 Subject: [PATCH 6/9] fix: standardize RequireApprovalForForkPRWorkflows naming in permissions --- github/actions_permissions_enterprise_test.go | 4 ++-- github/actions_permissions_orgs_test.go | 4 ++-- github/actions_workflows.go | 2 +- github/github-accessors.go | 8 ++++---- github/github-accessors_test.go | 10 +++++----- github/github-stringify_test.go | 4 ++-- github/repos_actions_permissions_test.go | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/github/actions_permissions_enterprise_test.go b/github/actions_permissions_enterprise_test.go index adaede0196d..97c6e9eb37e 100644 --- a/github/actions_permissions_enterprise_test.go +++ b/github/actions_permissions_enterprise_test.go @@ -542,7 +542,7 @@ func TestActionsService_GetPrivateRepoForkPRWorkflowSettingsInEnterprise(t *test RunWorkflowsFromForkPullRequests: Ptr(true), SendWriteTokensToWorkflows: Ptr(false), SendSecretsAndVariables: Ptr(true), - RequireApprovalForForkPrWorkflows: Ptr(false), + RequireApprovalForForkPRWorkflows: Ptr(false), } if !cmp.Equal(permissions, want) { t.Errorf("Actions.GetPrivateRepoForkPRWorkflowSettingsInEnterprise returned %+v, want %+v", permissions, want) @@ -571,7 +571,7 @@ func TestActionsService_EditPrivateRepoForkPRWorkflowSettingsInEnterprise(t *tes RunWorkflowsFromForkPullRequests: Ptr(true), SendWriteTokensToWorkflows: Ptr(false), SendSecretsAndVariables: Ptr(true), - RequireApprovalForForkPrWorkflows: Ptr(false), + RequireApprovalForForkPRWorkflows: Ptr(false), } mux.HandleFunc("/enterprises/e/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { diff --git a/github/actions_permissions_orgs_test.go b/github/actions_permissions_orgs_test.go index 463aa81cef2..fc9c1acb38d 100644 --- a/github/actions_permissions_orgs_test.go +++ b/github/actions_permissions_orgs_test.go @@ -712,7 +712,7 @@ func TestActionsService_GetPrivateRepoForkPRWorkflowSettingsInOrganization(t *te RunWorkflowsFromForkPullRequests: Ptr(true), SendWriteTokensToWorkflows: Ptr(false), SendSecretsAndVariables: Ptr(true), - RequireApprovalForForkPrWorkflows: Ptr(false), + RequireApprovalForForkPRWorkflows: Ptr(false), } if !cmp.Equal(permissions, want) { t.Errorf("Actions.GetPrivateRepoForkPRWorkflowSettingsInOrganization returned %+v, want %+v", permissions, want) @@ -741,7 +741,7 @@ func TestActionsService_EditPrivateRepoForkPRWorkflowSettingsInOrganization(t *t RunWorkflowsFromForkPullRequests: Ptr(true), SendWriteTokensToWorkflows: Ptr(false), SendSecretsAndVariables: Ptr(true), - RequireApprovalForForkPrWorkflows: Ptr(false), + RequireApprovalForForkPRWorkflows: Ptr(false), } mux.HandleFunc("/orgs/o/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { diff --git a/github/actions_workflows.go b/github/actions_workflows.go index 3822778d507..478fc691cce 100644 --- a/github/actions_workflows.go +++ b/github/actions_workflows.go @@ -61,7 +61,7 @@ type WorkflowsPermissions struct { RunWorkflowsFromForkPullRequests *bool `json:"run_workflows_from_fork_pull_requests,omitempty"` SendWriteTokensToWorkflows *bool `json:"send_write_tokens_to_workflows,omitempty"` SendSecretsAndVariables *bool `json:"send_secrets_and_variables,omitempty"` - RequireApprovalForForkPrWorkflows *bool `json:"require_approval_for_fork_pr_workflows,omitempty"` + RequireApprovalForForkPRWorkflows *bool `json:"require_approval_for_fork_pr_workflows,omitempty"` } func (w WorkflowsPermissions) String() string { diff --git a/github/github-accessors.go b/github/github-accessors.go index 92c767f89fe..26bafded636 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -29974,12 +29974,12 @@ func (w *Workflows) GetTotalCount() int { return *w.TotalCount } -// GetRequireApprovalForForkPrWorkflows returns the RequireApprovalForForkPrWorkflows field if it's non-nil, zero value otherwise. -func (w *WorkflowsPermissions) GetRequireApprovalForForkPrWorkflows() bool { - if w == nil || w.RequireApprovalForForkPrWorkflows == nil { +// GetRequireApprovalForForkPRWorkflows returns the RequireApprovalForForkPRWorkflows field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissions) GetRequireApprovalForForkPRWorkflows() bool { + if w == nil || w.RequireApprovalForForkPRWorkflows == nil { return false } - return *w.RequireApprovalForForkPrWorkflows + return *w.RequireApprovalForForkPRWorkflows } // GetRunWorkflowsFromForkPullRequests returns the RunWorkflowsFromForkPullRequests field if it's non-nil, zero value otherwise. diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index fb3e89a0017..54659af02eb 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -38630,15 +38630,15 @@ func TestWorkflows_GetTotalCount(tt *testing.T) { w.GetTotalCount() } -func TestWorkflowsPermissions_GetRequireApprovalForForkPrWorkflows(tt *testing.T) { +func TestWorkflowsPermissions_GetRequireApprovalForForkPRWorkflows(tt *testing.T) { tt.Parallel() var zeroValue bool - w := &WorkflowsPermissions{RequireApprovalForForkPrWorkflows: &zeroValue} - w.GetRequireApprovalForForkPrWorkflows() + w := &WorkflowsPermissions{RequireApprovalForForkPRWorkflows: &zeroValue} + w.GetRequireApprovalForForkPRWorkflows() w = &WorkflowsPermissions{} - w.GetRequireApprovalForForkPrWorkflows() + w.GetRequireApprovalForForkPRWorkflows() w = nil - w.GetRequireApprovalForForkPrWorkflows() + w.GetRequireApprovalForForkPRWorkflows() } func TestWorkflowsPermissions_GetRunWorkflowsFromForkPullRequests(tt *testing.T) { diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index 32ee73ffbb4..c1e757fccd4 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -2345,9 +2345,9 @@ func TestWorkflowsPermissions_String(t *testing.T) { RunWorkflowsFromForkPullRequests: Ptr(false), SendWriteTokensToWorkflows: Ptr(false), SendSecretsAndVariables: Ptr(false), - RequireApprovalForForkPrWorkflows: Ptr(false), + RequireApprovalForForkPRWorkflows: Ptr(false), } - want := `github.WorkflowsPermissions{RunWorkflowsFromForkPullRequests:false, SendWriteTokensToWorkflows:false, SendSecretsAndVariables:false, RequireApprovalForForkPrWorkflows:false}` + want := `github.WorkflowsPermissions{RunWorkflowsFromForkPullRequests:false, SendWriteTokensToWorkflows:false, SendSecretsAndVariables:false, RequireApprovalForForkPRWorkflows:false}` if got := v.String(); got != want { t.Errorf("WorkflowsPermissions.String = %v, want %v", got, want) } diff --git a/github/repos_actions_permissions_test.go b/github/repos_actions_permissions_test.go index 4721224639a..a584247b8f3 100644 --- a/github/repos_actions_permissions_test.go +++ b/github/repos_actions_permissions_test.go @@ -284,7 +284,7 @@ func TestRepositoriesService_GetPrivateRepoForkPRWorkflowSettings(t *testing.T) RunWorkflowsFromForkPullRequests: Ptr(true), SendWriteTokensToWorkflows: Ptr(false), SendSecretsAndVariables: Ptr(true), - RequireApprovalForForkPrWorkflows: Ptr(false), + RequireApprovalForForkPRWorkflows: Ptr(false), } if !cmp.Equal(permissions, want) { t.Errorf("Repositories.GetPrivateRepoForkPRWorkflowSettings returned %+v, want %+v", permissions, want) @@ -313,7 +313,7 @@ func TestRepositoriesService_EditPrivateRepoForkPRWorkflowSettings(t *testing.T) RunWorkflowsFromForkPullRequests: Ptr(true), SendWriteTokensToWorkflows: Ptr(false), SendSecretsAndVariables: Ptr(true), - RequireApprovalForForkPrWorkflows: Ptr(false), + RequireApprovalForForkPRWorkflows: Ptr(false), } mux.HandleFunc("/repos/o/r/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { From 9e8e91312338db65c8c28e724b08ca66e64441bd Mon Sep 17 00:00:00 2001 From: zyfy29 Date: Sat, 16 Aug 2025 07:29:04 +0900 Subject: [PATCH 7/9] fix: add WorkflowsPermissionsOpt to handle required field --- github/actions_permissions_enterprise.go | 2 +- github/actions_permissions_enterprise_test.go | 17 +++++----- github/actions_permissions_orgs.go | 2 +- github/actions_permissions_orgs_test.go | 17 +++++----- github/actions_workflows.go | 8 +++++ github/github-accessors.go | 24 ++++++++++++++ github/github-accessors_test.go | 33 +++++++++++++++++++ github/repos_actions_permissions.go | 2 +- github/repos_actions_permissions_test.go | 17 +++++----- 9 files changed, 92 insertions(+), 30 deletions(-) diff --git a/github/actions_permissions_enterprise.go b/github/actions_permissions_enterprise.go index 8177f2d63e8..96ec1002a4a 100644 --- a/github/actions_permissions_enterprise.go +++ b/github/actions_permissions_enterprise.go @@ -366,7 +366,7 @@ func (s *ActionsService) GetPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx co // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#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) EditPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string, permissions WorkflowsPermissions) (*Response, error) { +func (s *ActionsService) EditPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string, permissions *WorkflowsPermissionsOpt) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-workflows-private-repos", enterprise) req, err := s.client.NewRequest("PUT", u, permissions) if err != nil { diff --git a/github/actions_permissions_enterprise_test.go b/github/actions_permissions_enterprise_test.go index 97c6e9eb37e..5074dffcc30 100644 --- a/github/actions_permissions_enterprise_test.go +++ b/github/actions_permissions_enterprise_test.go @@ -567,15 +567,14 @@ func TestActionsService_EditPrivateRepoForkPRWorkflowSettingsInEnterprise(t *tes t.Parallel() client, mux, _ := setup(t) - input := &WorkflowsPermissions{ - RunWorkflowsFromForkPullRequests: Ptr(true), - SendWriteTokensToWorkflows: Ptr(false), - SendSecretsAndVariables: Ptr(true), - RequireApprovalForForkPRWorkflows: Ptr(false), + input := &WorkflowsPermissionsOpt{ + RunWorkflowsFromForkPullRequests: true, + SendWriteTokensToWorkflows: Ptr(false), + SendSecretsAndVariables: Ptr(true), } mux.HandleFunc("/enterprises/e/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { - v := new(WorkflowsPermissions) + v := new(WorkflowsPermissionsOpt) assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") @@ -586,7 +585,7 @@ func TestActionsService_EditPrivateRepoForkPRWorkflowSettingsInEnterprise(t *tes }) ctx := context.Background() - resp, err := client.Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "e", *input) + resp, err := client.Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "e", input) if err != nil { t.Errorf("Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise returned error: %v", err) } @@ -597,11 +596,11 @@ func TestActionsService_EditPrivateRepoForkPRWorkflowSettingsInEnterprise(t *tes const methodName = "EditPrivateRepoForkPRWorkflowSettingsInEnterprise" testBadOptions(t, methodName, func() (err error) { - _, err = client.Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "\n", *input) + _, err = client.Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "\n", input) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "e", *input) + return client.Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "e", input) }) } diff --git a/github/actions_permissions_orgs.go b/github/actions_permissions_orgs.go index 7c0ac2bf1ef..81a7bbdc897 100644 --- a/github/actions_permissions_orgs.go +++ b/github/actions_permissions_orgs.go @@ -474,7 +474,7 @@ func (s *ActionsService) GetPrivateRepoForkPRWorkflowSettingsInOrganization(ctx // GitHub API docs: https://docs.github.com/rest/actions/permissions#set-private-repo-fork-pr-workflow-settings-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions/fork-pr-workflows-private-repos -func (s *ActionsService) EditPrivateRepoForkPRWorkflowSettingsInOrganization(ctx context.Context, org string, permissions WorkflowsPermissions) (*Response, error) { +func (s *ActionsService) EditPrivateRepoForkPRWorkflowSettingsInOrganization(ctx context.Context, org string, permissions *WorkflowsPermissionsOpt) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-workflows-private-repos", org) req, err := s.client.NewRequest("PUT", u, permissions) if err != nil { diff --git a/github/actions_permissions_orgs_test.go b/github/actions_permissions_orgs_test.go index fc9c1acb38d..7f00db5a26d 100644 --- a/github/actions_permissions_orgs_test.go +++ b/github/actions_permissions_orgs_test.go @@ -737,15 +737,14 @@ func TestActionsService_EditPrivateRepoForkPRWorkflowSettingsInOrganization(t *t t.Parallel() client, mux, _ := setup(t) - input := &WorkflowsPermissions{ - RunWorkflowsFromForkPullRequests: Ptr(true), - SendWriteTokensToWorkflows: Ptr(false), - SendSecretsAndVariables: Ptr(true), - RequireApprovalForForkPRWorkflows: Ptr(false), + input := &WorkflowsPermissionsOpt{ + RunWorkflowsFromForkPullRequests: true, + SendWriteTokensToWorkflows: Ptr(false), + SendSecretsAndVariables: Ptr(true), } mux.HandleFunc("/orgs/o/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { - v := new(WorkflowsPermissions) + v := new(WorkflowsPermissionsOpt) assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") @@ -756,7 +755,7 @@ func TestActionsService_EditPrivateRepoForkPRWorkflowSettingsInOrganization(t *t }) ctx := context.Background() - resp, err := client.Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "o", *input) + resp, err := client.Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "o", input) if err != nil { t.Errorf("Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization returned error: %v", err) } @@ -767,11 +766,11 @@ func TestActionsService_EditPrivateRepoForkPRWorkflowSettingsInOrganization(t *t const methodName = "EditPrivateRepoForkPRWorkflowSettingsInOrganization" testBadOptions(t, methodName, func() (err error) { - _, err = client.Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "\n", *input) + _, err = client.Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "\n", input) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "o", *input) + return client.Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "o", input) }) } diff --git a/github/actions_workflows.go b/github/actions_workflows.go index 478fc691cce..dbde83cf306 100644 --- a/github/actions_workflows.go +++ b/github/actions_workflows.go @@ -68,6 +68,14 @@ func (w WorkflowsPermissions) String() string { return Stringify(w) } +// WorkflowsPermissionsOpt specifies options for editing workflows permissions in a repository. +type WorkflowsPermissionsOpt struct { + RunWorkflowsFromForkPullRequests bool `json:"run_workflows_from_fork_pull_requests"` + SendWriteTokensToWorkflows *bool `json:"send_write_tokens_to_workflows,omitempty"` + SendSecretsAndVariables *bool `json:"send_secrets_and_variables,omitempty"` + RequireApprovalForForkPRWorkflows *bool `json:"require_approval_for_fork_pr_workflows,omitempty"` +} + // ListWorkflows lists all workflows in a repository. // // GitHub API docs: https://docs.github.com/rest/actions/workflows#list-repository-workflows diff --git a/github/github-accessors.go b/github/github-accessors.go index 26bafded636..e5f45faf2a7 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -30006,6 +30006,30 @@ func (w *WorkflowsPermissions) GetSendWriteTokensToWorkflows() bool { return *w.SendWriteTokensToWorkflows } +// GetRequireApprovalForForkPRWorkflows returns the RequireApprovalForForkPRWorkflows field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissionsOpt) GetRequireApprovalForForkPRWorkflows() bool { + if w == nil || w.RequireApprovalForForkPRWorkflows == nil { + return false + } + return *w.RequireApprovalForForkPRWorkflows +} + +// GetSendSecretsAndVariables returns the SendSecretsAndVariables field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissionsOpt) GetSendSecretsAndVariables() bool { + if w == nil || w.SendSecretsAndVariables == nil { + return false + } + return *w.SendSecretsAndVariables +} + +// GetSendWriteTokensToWorkflows returns the SendWriteTokensToWorkflows field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissionsOpt) GetSendWriteTokensToWorkflows() bool { + if w == nil || w.SendWriteTokensToWorkflows == nil { + return false + } + return *w.SendWriteTokensToWorkflows +} + // GetDoNotEnforceOnCreate returns the DoNotEnforceOnCreate field if it's non-nil, zero value otherwise. func (w *WorkflowsRuleParameters) GetDoNotEnforceOnCreate() bool { if w == nil || w.DoNotEnforceOnCreate == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 54659af02eb..a7e054515da 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -38674,6 +38674,39 @@ func TestWorkflowsPermissions_GetSendWriteTokensToWorkflows(tt *testing.T) { w.GetSendWriteTokensToWorkflows() } +func TestWorkflowsPermissionsOpt_GetRequireApprovalForForkPRWorkflows(tt *testing.T) { + tt.Parallel() + var zeroValue bool + w := &WorkflowsPermissionsOpt{RequireApprovalForForkPRWorkflows: &zeroValue} + w.GetRequireApprovalForForkPRWorkflows() + w = &WorkflowsPermissionsOpt{} + w.GetRequireApprovalForForkPRWorkflows() + w = nil + w.GetRequireApprovalForForkPRWorkflows() +} + +func TestWorkflowsPermissionsOpt_GetSendSecretsAndVariables(tt *testing.T) { + tt.Parallel() + var zeroValue bool + w := &WorkflowsPermissionsOpt{SendSecretsAndVariables: &zeroValue} + w.GetSendSecretsAndVariables() + w = &WorkflowsPermissionsOpt{} + w.GetSendSecretsAndVariables() + w = nil + w.GetSendSecretsAndVariables() +} + +func TestWorkflowsPermissionsOpt_GetSendWriteTokensToWorkflows(tt *testing.T) { + tt.Parallel() + var zeroValue bool + w := &WorkflowsPermissionsOpt{SendWriteTokensToWorkflows: &zeroValue} + w.GetSendWriteTokensToWorkflows() + w = &WorkflowsPermissionsOpt{} + w.GetSendWriteTokensToWorkflows() + w = nil + w.GetSendWriteTokensToWorkflows() +} + func TestWorkflowsRuleParameters_GetDoNotEnforceOnCreate(tt *testing.T) { tt.Parallel() var zeroValue bool diff --git a/github/repos_actions_permissions.go b/github/repos_actions_permissions.go index 55392e8968d..a05593c5b82 100644 --- a/github/repos_actions_permissions.go +++ b/github/repos_actions_permissions.go @@ -181,7 +181,7 @@ func (s *RepositoriesService) GetPrivateRepoForkPRWorkflowSettings(ctx context.C // GitHub API docs: https://docs.github.com/rest/actions/permissions#set-private-repo-fork-pr-workflow-settings-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/permissions/fork-pr-workflows-private-repos -func (s *RepositoriesService) EditPrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string, permissions WorkflowsPermissions) (*Response, error) { +func (s *RepositoriesService) EditPrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string, permissions *WorkflowsPermissionsOpt) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-workflows-private-repos", owner, repo) req, err := s.client.NewRequest("PUT", u, permissions) if err != nil { diff --git a/github/repos_actions_permissions_test.go b/github/repos_actions_permissions_test.go index a584247b8f3..b438816bf4e 100644 --- a/github/repos_actions_permissions_test.go +++ b/github/repos_actions_permissions_test.go @@ -309,15 +309,14 @@ func TestRepositoriesService_EditPrivateRepoForkPRWorkflowSettings(t *testing.T) t.Parallel() client, mux, _ := setup(t) - input := &WorkflowsPermissions{ - RunWorkflowsFromForkPullRequests: Ptr(true), - SendWriteTokensToWorkflows: Ptr(false), - SendSecretsAndVariables: Ptr(true), - RequireApprovalForForkPRWorkflows: Ptr(false), + input := &WorkflowsPermissionsOpt{ + RunWorkflowsFromForkPullRequests: true, + SendWriteTokensToWorkflows: Ptr(false), + SendSecretsAndVariables: Ptr(true), } mux.HandleFunc("/repos/o/r/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { - v := new(WorkflowsPermissions) + v := new(WorkflowsPermissionsOpt) assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") @@ -328,7 +327,7 @@ func TestRepositoriesService_EditPrivateRepoForkPRWorkflowSettings(t *testing.T) }) ctx := context.Background() - resp, err := client.Repositories.EditPrivateRepoForkPRWorkflowSettings(ctx, "o", "r", *input) + resp, err := client.Repositories.EditPrivateRepoForkPRWorkflowSettings(ctx, "o", "r", input) if err != nil { t.Errorf("Repositories.EditPrivateRepoForkPRWorkflowSettings returned error: %v", err) } @@ -339,11 +338,11 @@ func TestRepositoriesService_EditPrivateRepoForkPRWorkflowSettings(t *testing.T) const methodName = "EditPrivateRepoForkPRWorkflowSettings" testBadOptions(t, methodName, func() (err error) { - _, err = client.Repositories.EditPrivateRepoForkPRWorkflowSettings(ctx, "\n", "\n", *input) + _, err = client.Repositories.EditPrivateRepoForkPRWorkflowSettings(ctx, "\n", "\n", input) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Repositories.EditPrivateRepoForkPRWorkflowSettings(ctx, "o", "r", *input) + return client.Repositories.EditPrivateRepoForkPRWorkflowSettings(ctx, "o", "r", input) }) } From 0c11edd27c7a32cbd52acaa5b9c70c78e1722e32 Mon Sep 17 00:00:00 2001 From: zyfy29 Date: Tue, 19 Aug 2025 14:09:15 +0900 Subject: [PATCH 8/9] chore: rename method name 'Edit' to 'Update' --- github/actions_permissions_enterprise.go | 4 ++-- github/actions_permissions_enterprise_test.go | 12 ++++++------ github/actions_permissions_orgs.go | 4 ++-- github/actions_permissions_orgs_test.go | 12 ++++++------ github/repos_actions_permissions.go | 4 ++-- github/repos_actions_permissions_test.go | 12 ++++++------ 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/github/actions_permissions_enterprise.go b/github/actions_permissions_enterprise.go index 96ec1002a4a..fc4b67110a1 100644 --- a/github/actions_permissions_enterprise.go +++ b/github/actions_permissions_enterprise.go @@ -361,12 +361,12 @@ func (s *ActionsService) GetPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx co return permissions, resp, nil } -// EditPrivateRepoForkPRWorkflowSettingsInEnterprise sets the settings for whether workflows from fork pull requests can run on private repositories in an enterprise. +// UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise sets the settings for whether workflows from fork pull requests can run on private repositories in an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#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) EditPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string, permissions *WorkflowsPermissionsOpt) (*Response, error) { +func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string, permissions *WorkflowsPermissionsOpt) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-workflows-private-repos", enterprise) req, err := s.client.NewRequest("PUT", u, permissions) if err != nil { diff --git a/github/actions_permissions_enterprise_test.go b/github/actions_permissions_enterprise_test.go index 5074dffcc30..c1097adbfb1 100644 --- a/github/actions_permissions_enterprise_test.go +++ b/github/actions_permissions_enterprise_test.go @@ -585,22 +585,22 @@ func TestActionsService_EditPrivateRepoForkPRWorkflowSettingsInEnterprise(t *tes }) ctx := context.Background() - resp, err := client.Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "e", input) + resp, err := client.Actions.UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "e", input) if err != nil { - t.Errorf("Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise returned error: %v", err) + t.Errorf("Actions.UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise returned error: %v", err) } if resp.StatusCode != http.StatusNoContent { - t.Errorf("Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise = %d, want %d", resp.StatusCode, http.StatusNoContent) + t.Errorf("Actions.UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise = %d, want %d", resp.StatusCode, http.StatusNoContent) } - const methodName = "EditPrivateRepoForkPRWorkflowSettingsInEnterprise" + const methodName = "UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise" testBadOptions(t, methodName, func() (err error) { - _, err = client.Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "\n", input) + _, err = client.Actions.UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "\n", input) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.EditPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "e", input) + return client.Actions.UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(ctx, "e", input) }) } diff --git a/github/actions_permissions_orgs.go b/github/actions_permissions_orgs.go index 81a7bbdc897..fdd3181c580 100644 --- a/github/actions_permissions_orgs.go +++ b/github/actions_permissions_orgs.go @@ -469,12 +469,12 @@ func (s *ActionsService) GetPrivateRepoForkPRWorkflowSettingsInOrganization(ctx return permissions, resp, nil } -// EditPrivateRepoForkPRWorkflowSettingsInOrganization sets the settings for whether workflows from fork pull requests can run on private repositories in an organization. +// UpdatePrivateRepoForkPRWorkflowSettingsInOrganization sets the settings for whether workflows from fork pull requests can run on private repositories in an organization. // // GitHub API docs: https://docs.github.com/rest/actions/permissions#set-private-repo-fork-pr-workflow-settings-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions/fork-pr-workflows-private-repos -func (s *ActionsService) EditPrivateRepoForkPRWorkflowSettingsInOrganization(ctx context.Context, org string, permissions *WorkflowsPermissionsOpt) (*Response, error) { +func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInOrganization(ctx context.Context, org string, permissions *WorkflowsPermissionsOpt) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-workflows-private-repos", org) req, err := s.client.NewRequest("PUT", u, permissions) if err != nil { diff --git a/github/actions_permissions_orgs_test.go b/github/actions_permissions_orgs_test.go index 7f00db5a26d..60ef6e87ff1 100644 --- a/github/actions_permissions_orgs_test.go +++ b/github/actions_permissions_orgs_test.go @@ -755,22 +755,22 @@ func TestActionsService_EditPrivateRepoForkPRWorkflowSettingsInOrganization(t *t }) ctx := context.Background() - resp, err := client.Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "o", input) + resp, err := client.Actions.UpdatePrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "o", input) if err != nil { - t.Errorf("Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization returned error: %v", err) + t.Errorf("Actions.UpdatePrivateRepoForkPRWorkflowSettingsInOrganization returned error: %v", err) } if resp.StatusCode != http.StatusNoContent { - t.Errorf("Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization = %d, want %d", resp.StatusCode, http.StatusNoContent) + t.Errorf("Actions.UpdatePrivateRepoForkPRWorkflowSettingsInOrganization = %d, want %d", resp.StatusCode, http.StatusNoContent) } - const methodName = "EditPrivateRepoForkPRWorkflowSettingsInOrganization" + const methodName = "UpdatePrivateRepoForkPRWorkflowSettingsInOrganization" testBadOptions(t, methodName, func() (err error) { - _, err = client.Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "\n", input) + _, err = client.Actions.UpdatePrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "\n", input) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.EditPrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "o", input) + return client.Actions.UpdatePrivateRepoForkPRWorkflowSettingsInOrganization(ctx, "o", input) }) } diff --git a/github/repos_actions_permissions.go b/github/repos_actions_permissions.go index a05593c5b82..902c818a425 100644 --- a/github/repos_actions_permissions.go +++ b/github/repos_actions_permissions.go @@ -176,12 +176,12 @@ func (s *RepositoriesService) GetPrivateRepoForkPRWorkflowSettings(ctx context.C return permissions, resp, nil } -// EditPrivateRepoForkPRWorkflowSettings sets the settings for whether workflows from fork pull requests can run on a private repository. +// UpdatePrivateRepoForkPRWorkflowSettings sets the settings for whether workflows from fork pull requests can run on a private repository. // // GitHub API docs: https://docs.github.com/rest/actions/permissions#set-private-repo-fork-pr-workflow-settings-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/permissions/fork-pr-workflows-private-repos -func (s *RepositoriesService) EditPrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string, permissions *WorkflowsPermissionsOpt) (*Response, error) { +func (s *RepositoriesService) UpdatePrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string, permissions *WorkflowsPermissionsOpt) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-workflows-private-repos", owner, repo) req, err := s.client.NewRequest("PUT", u, permissions) if err != nil { diff --git a/github/repos_actions_permissions_test.go b/github/repos_actions_permissions_test.go index b438816bf4e..a1cc9fa507c 100644 --- a/github/repos_actions_permissions_test.go +++ b/github/repos_actions_permissions_test.go @@ -327,22 +327,22 @@ func TestRepositoriesService_EditPrivateRepoForkPRWorkflowSettings(t *testing.T) }) ctx := context.Background() - resp, err := client.Repositories.EditPrivateRepoForkPRWorkflowSettings(ctx, "o", "r", input) + resp, err := client.Repositories.UpdatePrivateRepoForkPRWorkflowSettings(ctx, "o", "r", input) if err != nil { - t.Errorf("Repositories.EditPrivateRepoForkPRWorkflowSettings returned error: %v", err) + t.Errorf("Repositories.UpdatePrivateRepoForkPRWorkflowSettings returned error: %v", err) } if resp.StatusCode != http.StatusNoContent { - t.Errorf("Repositories.EditPrivateRepoForkPRWorkflowSettings = %d, want %d", resp.StatusCode, http.StatusNoContent) + t.Errorf("Repositories.UpdatePrivateRepoForkPRWorkflowSettings = %d, want %d", resp.StatusCode, http.StatusNoContent) } - const methodName = "EditPrivateRepoForkPRWorkflowSettings" + const methodName = "UpdatePrivateRepoForkPRWorkflowSettings" testBadOptions(t, methodName, func() (err error) { - _, err = client.Repositories.EditPrivateRepoForkPRWorkflowSettings(ctx, "\n", "\n", input) + _, err = client.Repositories.UpdatePrivateRepoForkPRWorkflowSettings(ctx, "\n", "\n", input) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Repositories.EditPrivateRepoForkPRWorkflowSettings(ctx, "o", "r", input) + return client.Repositories.UpdatePrivateRepoForkPRWorkflowSettings(ctx, "o", "r", input) }) } From c4d4feae2bb05ba1a3b10a550a61e85ce59381dd Mon Sep 17 00:00:00 2001 From: zyfy29 Date: Tue, 19 Aug 2025 21:51:14 +0900 Subject: [PATCH 9/9] fix: rename test methods from 'Edit' to 'Update' for consistency --- github/actions_permissions_enterprise_test.go | 2 +- github/actions_permissions_orgs_test.go | 2 +- github/repos_actions_permissions_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/github/actions_permissions_enterprise_test.go b/github/actions_permissions_enterprise_test.go index c1097adbfb1..30c8cdfa97b 100644 --- a/github/actions_permissions_enterprise_test.go +++ b/github/actions_permissions_enterprise_test.go @@ -563,7 +563,7 @@ func TestActionsService_GetPrivateRepoForkPRWorkflowSettingsInEnterprise(t *test }) } -func TestActionsService_EditPrivateRepoForkPRWorkflowSettingsInEnterprise(t *testing.T) { +func TestActionsService_UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(t *testing.T) { t.Parallel() client, mux, _ := setup(t) diff --git a/github/actions_permissions_orgs_test.go b/github/actions_permissions_orgs_test.go index 60ef6e87ff1..6b044c688e8 100644 --- a/github/actions_permissions_orgs_test.go +++ b/github/actions_permissions_orgs_test.go @@ -733,7 +733,7 @@ func TestActionsService_GetPrivateRepoForkPRWorkflowSettingsInOrganization(t *te }) } -func TestActionsService_EditPrivateRepoForkPRWorkflowSettingsInOrganization(t *testing.T) { +func TestActionsService_UpdatePrivateRepoForkPRWorkflowSettingsInOrganization(t *testing.T) { t.Parallel() client, mux, _ := setup(t) diff --git a/github/repos_actions_permissions_test.go b/github/repos_actions_permissions_test.go index a1cc9fa507c..bc41531096d 100644 --- a/github/repos_actions_permissions_test.go +++ b/github/repos_actions_permissions_test.go @@ -305,7 +305,7 @@ func TestRepositoriesService_GetPrivateRepoForkPRWorkflowSettings(t *testing.T) }) } -func TestRepositoriesService_EditPrivateRepoForkPRWorkflowSettings(t *testing.T) { +func TestRepositoriesService_UpdatePrivateRepoForkPRWorkflowSettings(t *testing.T) { t.Parallel() client, mux, _ := setup(t)