From 2f504f97fd6c99301bd3fe98b310b76a0663ef2e Mon Sep 17 00:00:00 2001 From: Lina Kaci <82088784+LinaKACI-pro@users.noreply.github.com> Date: Sat, 21 Feb 2026 16:13:35 +0100 Subject: [PATCH 1/4] feat: support workflow dispatch run details in response --- github/actions_workflows.go | 29 +++++-- github/actions_workflows_test.go | 126 ++++++++++++++++++++++++++++--- github/github-accessors.go | 32 ++++++++ github/github-accessors_test.go | 44 +++++++++++ 4 files changed, 213 insertions(+), 18 deletions(-) diff --git a/github/actions_workflows.go b/github/actions_workflows.go index e0bcde35115..79d2708b365 100644 --- a/github/actions_workflows.go +++ b/github/actions_workflows.go @@ -51,9 +51,20 @@ type CreateWorkflowDispatchEventRequest struct { // Ref is required when creating a workflow dispatch event. Ref string `json:"ref"` // Inputs represents input keys and values configured in the workflow file. - // The maximum number of properties is 10. + // The maximum number of properties is 25. // Default: Any default properties configured in the workflow file will be used when `inputs` are omitted. Inputs map[string]any `json:"inputs,omitempty"` + // ReturnRunDetails specifies whether the response should include + // the workflow run ID and URLs. + ReturnRunDetails *bool `json:"return_run_details,omitempty"` +} + +// CreateWorkflowDispatchEventResponse represents the response from creating +// a workflow dispatch event when ReturnRunDetails is set to true. +type CreateWorkflowDispatchEventResponse struct { + WorkflowRunID *int64 `json:"workflow_run_id,omitempty"` + RunURL *string `json:"run_url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` } // WorkflowsPermissions represents the permissions for workflows in a repository. @@ -191,7 +202,7 @@ func (s *ActionsService) getWorkflowUsage(ctx context.Context, url string) (*Wor // GitHub API docs: https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event // //meta:operation POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches -func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, owner, repo string, workflowID int64, event CreateWorkflowDispatchEventRequest) (*Response, error) { +func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, owner, repo string, workflowID int64, event CreateWorkflowDispatchEventRequest) (*CreateWorkflowDispatchEventResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowID) return s.createWorkflowDispatchEvent(ctx, u, &event) @@ -202,19 +213,25 @@ func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, ow // GitHub API docs: https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event // //meta:operation POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches -func (s *ActionsService) CreateWorkflowDispatchEventByFileName(ctx context.Context, owner, repo, workflowFileName string, event CreateWorkflowDispatchEventRequest) (*Response, error) { +func (s *ActionsService) CreateWorkflowDispatchEventByFileName(ctx context.Context, owner, repo, workflowFileName string, event CreateWorkflowDispatchEventRequest) (*CreateWorkflowDispatchEventResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowFileName) return s.createWorkflowDispatchEvent(ctx, u, &event) } -func (s *ActionsService) createWorkflowDispatchEvent(ctx context.Context, url string, event *CreateWorkflowDispatchEventRequest) (*Response, error) { +func (s *ActionsService) createWorkflowDispatchEvent(ctx context.Context, url string, event *CreateWorkflowDispatchEventRequest) (*CreateWorkflowDispatchEventResponse, *Response, error) { req, err := s.client.NewRequest("POST", url, event) if err != nil { - return nil, err + return nil, nil, err } - return s.client.Do(ctx, req, nil) + dispatchResponse := new(CreateWorkflowDispatchEventResponse) + resp, err := s.client.Do(ctx, req, dispatchResponse) + if err != nil { + return nil, resp, err + } + + return dispatchResponse, resp, nil } // EnableWorkflowByID enables a workflow and sets the state of the workflow to "active". diff --git a/github/actions_workflows_test.go b/github/actions_workflows_test.go index d6fb4615e1c..0300667d9fe 100644 --- a/github/actions_workflows_test.go +++ b/github/actions_workflows_test.go @@ -235,12 +235,13 @@ func TestActionsService_CreateWorkflowDispatchEventByID(t *testing.T) { client, mux, _ := setup(t) event := CreateWorkflowDispatchEventRequest{ - Ref: "d4cfb6e7", + Ref: "d4cfb6e7", + ReturnRunDetails: Ptr(true), Inputs: map[string]any{ "key": "value", }, } - mux.HandleFunc("/repos/o/r/actions/workflows/72844/dispatches", func(_ http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/actions/workflows/72844/dispatches", func(w http.ResponseWriter, r *http.Request) { var v CreateWorkflowDispatchEventRequest assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) @@ -248,29 +249,45 @@ func TestActionsService_CreateWorkflowDispatchEventByID(t *testing.T) { if !cmp.Equal(v, event) { t.Errorf("Request body = %+v, want %+v", v, event) } + + w.WriteHeader(http.StatusOK) + fmt.Fprint(w, `{"workflow_run_id":1,"run_url":"https://api.github.com/repos/o/r/actions/runs/1","html_url":"https://github.com/o/r/actions/runs/1"}`) }) ctx := t.Context() - _, err := client.Actions.CreateWorkflowDispatchEventByID(ctx, "o", "r", 72844, event) + dispatchResponse, _, err := client.Actions.CreateWorkflowDispatchEventByID(ctx, "o", "r", 72844, event) if err != nil { t.Errorf("Actions.CreateWorkflowDispatchEventByID returned error: %v", err) } + want := &CreateWorkflowDispatchEventResponse{ + WorkflowRunID: Ptr(int64(1)), + RunURL: Ptr("https://api.github.com/repos/o/r/actions/runs/1"), + HTMLURL: Ptr("https://github.com/o/r/actions/runs/1"), + } + if !cmp.Equal(dispatchResponse, want) { + t.Errorf("Actions.CreateWorkflowDispatchEventByID = %+v, want %+v", dispatchResponse, want) + } + // Test s.client.NewRequest failure client.BaseURL.Path = "" - _, err = client.Actions.CreateWorkflowDispatchEventByID(ctx, "o", "r", 72844, event) + _, _, err = client.Actions.CreateWorkflowDispatchEventByID(ctx, "o", "r", 72844, event) if err == nil { t.Error("client.BaseURL.Path='' CreateWorkflowDispatchEventByID err = nil, want error") } const methodName = "CreateWorkflowDispatchEventByID" testBadOptions(t, methodName, func() (err error) { - _, err = client.Actions.CreateWorkflowDispatchEventByID(ctx, "o", "r", 72844, event) + _, _, err = client.Actions.CreateWorkflowDispatchEventByID(ctx, "o", "r", 72844, event) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.CreateWorkflowDispatchEventByID(ctx, "o", "r", 72844, event) + got, resp, err := client.Actions.CreateWorkflowDispatchEventByID(ctx, "o", "r", 72844, event) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err }) } @@ -279,12 +296,13 @@ func TestActionsService_CreateWorkflowDispatchEventByFileName(t *testing.T) { client, mux, _ := setup(t) event := CreateWorkflowDispatchEventRequest{ - Ref: "d4cfb6e7", + Ref: "d4cfb6e7", + ReturnRunDetails: Ptr(true), Inputs: map[string]any{ "key": "value", }, } - mux.HandleFunc("/repos/o/r/actions/workflows/main.yml/dispatches", func(_ http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/actions/workflows/main.yml/dispatches", func(w http.ResponseWriter, r *http.Request) { var v CreateWorkflowDispatchEventRequest assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) @@ -292,30 +310,114 @@ func TestActionsService_CreateWorkflowDispatchEventByFileName(t *testing.T) { if !cmp.Equal(v, event) { t.Errorf("Request body = %+v, want %+v", v, event) } + + w.WriteHeader(http.StatusOK) + fmt.Fprint(w, `{"workflow_run_id":1,"run_url":"https://api.github.com/repos/o/r/actions/runs/1","html_url":"https://github.com/o/r/actions/runs/1"}`) }) ctx := t.Context() - _, err := client.Actions.CreateWorkflowDispatchEventByFileName(ctx, "o", "r", "main.yml", event) + dispatchResponse, _, err := client.Actions.CreateWorkflowDispatchEventByFileName(ctx, "o", "r", "main.yml", event) if err != nil { t.Errorf("Actions.CreateWorkflowDispatchEventByFileName returned error: %v", err) } + want := &CreateWorkflowDispatchEventResponse{ + WorkflowRunID: Ptr(int64(1)), + RunURL: Ptr("https://api.github.com/repos/o/r/actions/runs/1"), + HTMLURL: Ptr("https://github.com/o/r/actions/runs/1"), + } + if !cmp.Equal(dispatchResponse, want) { + t.Errorf("Actions.CreateWorkflowDispatchEventByFileName = %+v, want %+v", dispatchResponse, want) + } + // Test s.client.NewRequest failure client.BaseURL.Path = "" - _, err = client.Actions.CreateWorkflowDispatchEventByFileName(ctx, "o", "r", "main.yml", event) + _, _, err = client.Actions.CreateWorkflowDispatchEventByFileName(ctx, "o", "r", "main.yml", event) if err == nil { t.Error("client.BaseURL.Path='' CreateWorkflowDispatchEventByFileName err = nil, want error") } const methodName = "CreateWorkflowDispatchEventByFileName" testBadOptions(t, methodName, func() (err error) { - _, err = client.Actions.CreateWorkflowDispatchEventByFileName(ctx, "o", "r", "main.yml", event) + _, _, err = client.Actions.CreateWorkflowDispatchEventByFileName(ctx, "o", "r", "main.yml", event) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.CreateWorkflowDispatchEventByFileName(ctx, "o", "r", "main.yml", event) + got, resp, err := client.Actions.CreateWorkflowDispatchEventByFileName(ctx, "o", "r", "main.yml", event) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestActionsService_CreateWorkflowDispatchEventByID_noRunDetails(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + + event := CreateWorkflowDispatchEventRequest{ + Ref: "d4cfb6e7", + Inputs: map[string]any{ + "key": "value", + }, + } + mux.HandleFunc("/repos/o/r/actions/workflows/72844/dispatches", func(w http.ResponseWriter, r *http.Request) { + var v CreateWorkflowDispatchEventRequest + assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) + + testMethod(t, r, "POST") + if !cmp.Equal(v, event) { + t.Errorf("Request body = %+v, want %+v", v, event) + } + + w.WriteHeader(http.StatusNoContent) + }) + + ctx := t.Context() + dispatchResponse, _, err := client.Actions.CreateWorkflowDispatchEventByID(ctx, "o", "r", 72844, event) + if err != nil { + t.Errorf("Actions.CreateWorkflowDispatchEventByID returned error: %v", err) + } + + want := &CreateWorkflowDispatchEventResponse{} + if !cmp.Equal(dispatchResponse, want) { + t.Errorf("Actions.CreateWorkflowDispatchEventByID = %+v, want %+v", dispatchResponse, want) + } +} + +func TestActionsService_CreateWorkflowDispatchEventByFileName_noRunDetails(t *testing.T) { + t.Parallel() + client, mux, _ := setup(t) + + event := CreateWorkflowDispatchEventRequest{ + Ref: "d4cfb6e7", + Inputs: map[string]any{ + "key": "value", + }, + } + mux.HandleFunc("/repos/o/r/actions/workflows/main.yml/dispatches", func(w http.ResponseWriter, r *http.Request) { + var v CreateWorkflowDispatchEventRequest + assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) + + testMethod(t, r, "POST") + if !cmp.Equal(v, event) { + t.Errorf("Request body = %+v, want %+v", v, event) + } + + w.WriteHeader(http.StatusNoContent) }) + + ctx := t.Context() + dispatchResponse, _, err := client.Actions.CreateWorkflowDispatchEventByFileName(ctx, "o", "r", "main.yml", event) + if err != nil { + t.Errorf("Actions.CreateWorkflowDispatchEventByFileName returned error: %v", err) + } + + want := &CreateWorkflowDispatchEventResponse{} + if !cmp.Equal(dispatchResponse, want) { + t.Errorf("Actions.CreateWorkflowDispatchEventByFileName = %+v, want %+v", dispatchResponse, want) + } } func TestActionsService_EnableWorkflowByID(t *testing.T) { diff --git a/github/github-accessors.go b/github/github-accessors.go index ec77299f2fe..674f998e7ad 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -7174,6 +7174,38 @@ func (c *CreateWorkflowDispatchEventRequest) GetInputs() map[string]any { return c.Inputs } +// GetReturnRunDetails returns the ReturnRunDetails field if it's non-nil, zero value otherwise. +func (c *CreateWorkflowDispatchEventRequest) GetReturnRunDetails() bool { + if c == nil || c.ReturnRunDetails == nil { + return false + } + return *c.ReturnRunDetails +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (c *CreateWorkflowDispatchEventResponse) GetHTMLURL() string { + if c == nil || c.HTMLURL == nil { + return "" + } + return *c.HTMLURL +} + +// GetRunURL returns the RunURL field if it's non-nil, zero value otherwise. +func (c *CreateWorkflowDispatchEventResponse) GetRunURL() string { + if c == nil || c.RunURL == nil { + return "" + } + return *c.RunURL +} + +// GetWorkflowRunID returns the WorkflowRunID field if it's non-nil, zero value otherwise. +func (c *CreateWorkflowDispatchEventResponse) GetWorkflowRunID() int64 { + if c == nil || c.WorkflowRunID == nil { + return 0 + } + return *c.WorkflowRunID +} + // GetCreated returns the Created field if it's non-nil, zero value otherwise. func (c *CreationInfo) GetCreated() Timestamp { if c == nil || c.Created == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 08332e3776d..7e2ea1686c4 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -9395,6 +9395,50 @@ func TestCreateWorkflowDispatchEventRequest_GetInputs(tt *testing.T) { c.GetInputs() } +func TestCreateWorkflowDispatchEventRequest_GetReturnRunDetails(tt *testing.T) { + tt.Parallel() + var zeroValue bool + c := &CreateWorkflowDispatchEventRequest{ReturnRunDetails: &zeroValue} + c.GetReturnRunDetails() + c = &CreateWorkflowDispatchEventRequest{} + c.GetReturnRunDetails() + c = nil + c.GetReturnRunDetails() +} + +func TestCreateWorkflowDispatchEventResponse_GetHTMLURL(tt *testing.T) { + tt.Parallel() + var zeroValue string + c := &CreateWorkflowDispatchEventResponse{HTMLURL: &zeroValue} + c.GetHTMLURL() + c = &CreateWorkflowDispatchEventResponse{} + c.GetHTMLURL() + c = nil + c.GetHTMLURL() +} + +func TestCreateWorkflowDispatchEventResponse_GetRunURL(tt *testing.T) { + tt.Parallel() + var zeroValue string + c := &CreateWorkflowDispatchEventResponse{RunURL: &zeroValue} + c.GetRunURL() + c = &CreateWorkflowDispatchEventResponse{} + c.GetRunURL() + c = nil + c.GetRunURL() +} + +func TestCreateWorkflowDispatchEventResponse_GetWorkflowRunID(tt *testing.T) { + tt.Parallel() + var zeroValue int64 + c := &CreateWorkflowDispatchEventResponse{WorkflowRunID: &zeroValue} + c.GetWorkflowRunID() + c = &CreateWorkflowDispatchEventResponse{} + c.GetWorkflowRunID() + c = nil + c.GetWorkflowRunID() +} + func TestCreationInfo_GetCreated(tt *testing.T) { tt.Parallel() var zeroValue Timestamp From 6817b9eada399dbf8d625530f1bd7701ad38f4e7 Mon Sep 17 00:00:00 2001 From: Lina Kaci <82088784+LinaKACI-pro@users.noreply.github.com> Date: Mon, 23 Feb 2026 21:25:39 +0100 Subject: [PATCH 2/4] fix: return nil dispatch response when API returns 204 No Content --- github/actions_workflows.go | 4 ++-- github/actions_workflows_test.go | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/github/actions_workflows.go b/github/actions_workflows.go index 79d2708b365..76000aafb31 100644 --- a/github/actions_workflows.go +++ b/github/actions_workflows.go @@ -225,8 +225,8 @@ func (s *ActionsService) createWorkflowDispatchEvent(ctx context.Context, url st return nil, nil, err } - dispatchResponse := new(CreateWorkflowDispatchEventResponse) - resp, err := s.client.Do(ctx, req, dispatchResponse) + var dispatchResponse *CreateWorkflowDispatchEventResponse + resp, err := s.client.Do(ctx, req, &dispatchResponse) if err != nil { return nil, resp, err } diff --git a/github/actions_workflows_test.go b/github/actions_workflows_test.go index 0300667d9fe..81f52c99e5e 100644 --- a/github/actions_workflows_test.go +++ b/github/actions_workflows_test.go @@ -380,9 +380,8 @@ func TestActionsService_CreateWorkflowDispatchEventByID_noRunDetails(t *testing. t.Errorf("Actions.CreateWorkflowDispatchEventByID returned error: %v", err) } - want := &CreateWorkflowDispatchEventResponse{} - if !cmp.Equal(dispatchResponse, want) { - t.Errorf("Actions.CreateWorkflowDispatchEventByID = %+v, want %+v", dispatchResponse, want) + if dispatchResponse != nil { + t.Errorf("Actions.CreateWorkflowDispatchEventByID = %+v, want nil", dispatchResponse) } } @@ -414,9 +413,8 @@ func TestActionsService_CreateWorkflowDispatchEventByFileName_noRunDetails(t *te t.Errorf("Actions.CreateWorkflowDispatchEventByFileName returned error: %v", err) } - want := &CreateWorkflowDispatchEventResponse{} - if !cmp.Equal(dispatchResponse, want) { - t.Errorf("Actions.CreateWorkflowDispatchEventByFileName = %+v, want %+v", dispatchResponse, want) + if dispatchResponse != nil { + t.Errorf("Actions.CreateWorkflowDispatchEventByFileName = %+v, want nil", dispatchResponse) } } From f71d3814040cbeb30f7e4b33bcc3413b10c2633d Mon Sep 17 00:00:00 2001 From: LinaKACI-pro <82088784+LinaKACI-pro@users.noreply.github.com> Date: Tue, 24 Feb 2026 16:25:15 +0100 Subject: [PATCH 3/4] refactor: struct naming WorkflowDispatchRunDetails --- github/actions_workflows.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/github/actions_workflows.go b/github/actions_workflows.go index 76000aafb31..582949f4d8f 100644 --- a/github/actions_workflows.go +++ b/github/actions_workflows.go @@ -59,9 +59,9 @@ type CreateWorkflowDispatchEventRequest struct { ReturnRunDetails *bool `json:"return_run_details,omitempty"` } -// CreateWorkflowDispatchEventResponse represents the response from creating +// WorkflowDispatchRunDetails represents the response from creating // a workflow dispatch event when ReturnRunDetails is set to true. -type CreateWorkflowDispatchEventResponse struct { +type WorkflowDispatchRunDetails struct { WorkflowRunID *int64 `json:"workflow_run_id,omitempty"` RunURL *string `json:"run_url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` @@ -202,7 +202,7 @@ func (s *ActionsService) getWorkflowUsage(ctx context.Context, url string) (*Wor // GitHub API docs: https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event // //meta:operation POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches -func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, owner, repo string, workflowID int64, event CreateWorkflowDispatchEventRequest) (*CreateWorkflowDispatchEventResponse, *Response, error) { +func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, owner, repo string, workflowID int64, event CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowID) return s.createWorkflowDispatchEvent(ctx, u, &event) @@ -213,25 +213,25 @@ func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, ow // GitHub API docs: https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event // //meta:operation POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches -func (s *ActionsService) CreateWorkflowDispatchEventByFileName(ctx context.Context, owner, repo, workflowFileName string, event CreateWorkflowDispatchEventRequest) (*CreateWorkflowDispatchEventResponse, *Response, error) { +func (s *ActionsService) CreateWorkflowDispatchEventByFileName(ctx context.Context, owner, repo, workflowFileName string, event CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowFileName) return s.createWorkflowDispatchEvent(ctx, u, &event) } -func (s *ActionsService) createWorkflowDispatchEvent(ctx context.Context, url string, event *CreateWorkflowDispatchEventRequest) (*CreateWorkflowDispatchEventResponse, *Response, error) { +func (s *ActionsService) createWorkflowDispatchEvent(ctx context.Context, url string, event *CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { req, err := s.client.NewRequest("POST", url, event) if err != nil { return nil, nil, err } - var dispatchResponse *CreateWorkflowDispatchEventResponse - resp, err := s.client.Do(ctx, req, &dispatchResponse) + var dispatchRunDetails *WorkflowDispatchRunDetails + resp, err := s.client.Do(ctx, req, &dispatchRunDetails) if err != nil { return nil, resp, err } - return dispatchResponse, resp, nil + return dispatchRunDetails, resp, nil } // EnableWorkflowByID enables a workflow and sets the state of the workflow to "active". From 40a1676e275c5a703c95f308809262a5fa2978a5 Mon Sep 17 00:00:00 2001 From: LinaKACI-pro <82088784+LinaKACI-pro@users.noreply.github.com> Date: Tue, 24 Feb 2026 16:27:48 +0100 Subject: [PATCH 4/4] refactor: struct naming WorkflowDispatchRunDetails on unit tests --- github/actions_workflows_test.go | 4 +- github/github-accessors.go | 48 +++++++++++------------ github/github-accessors_test.go | 66 ++++++++++++++++---------------- 3 files changed, 59 insertions(+), 59 deletions(-) diff --git a/github/actions_workflows_test.go b/github/actions_workflows_test.go index 81f52c99e5e..594906b269a 100644 --- a/github/actions_workflows_test.go +++ b/github/actions_workflows_test.go @@ -260,7 +260,7 @@ func TestActionsService_CreateWorkflowDispatchEventByID(t *testing.T) { t.Errorf("Actions.CreateWorkflowDispatchEventByID returned error: %v", err) } - want := &CreateWorkflowDispatchEventResponse{ + want := &WorkflowDispatchRunDetails{ WorkflowRunID: Ptr(int64(1)), RunURL: Ptr("https://api.github.com/repos/o/r/actions/runs/1"), HTMLURL: Ptr("https://github.com/o/r/actions/runs/1"), @@ -321,7 +321,7 @@ func TestActionsService_CreateWorkflowDispatchEventByFileName(t *testing.T) { t.Errorf("Actions.CreateWorkflowDispatchEventByFileName returned error: %v", err) } - want := &CreateWorkflowDispatchEventResponse{ + want := &WorkflowDispatchRunDetails{ WorkflowRunID: Ptr(int64(1)), RunURL: Ptr("https://api.github.com/repos/o/r/actions/runs/1"), HTMLURL: Ptr("https://github.com/o/r/actions/runs/1"), diff --git a/github/github-accessors.go b/github/github-accessors.go index 674f998e7ad..6d8dcb7fd30 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -7182,30 +7182,6 @@ func (c *CreateWorkflowDispatchEventRequest) GetReturnRunDetails() bool { return *c.ReturnRunDetails } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (c *CreateWorkflowDispatchEventResponse) GetHTMLURL() string { - if c == nil || c.HTMLURL == nil { - return "" - } - return *c.HTMLURL -} - -// GetRunURL returns the RunURL field if it's non-nil, zero value otherwise. -func (c *CreateWorkflowDispatchEventResponse) GetRunURL() string { - if c == nil || c.RunURL == nil { - return "" - } - return *c.RunURL -} - -// GetWorkflowRunID returns the WorkflowRunID field if it's non-nil, zero value otherwise. -func (c *CreateWorkflowDispatchEventResponse) GetWorkflowRunID() int64 { - if c == nil || c.WorkflowRunID == nil { - return 0 - } - return *c.WorkflowRunID -} - // GetCreated returns the Created field if it's non-nil, zero value otherwise. func (c *CreationInfo) GetCreated() Timestamp { if c == nil || c.Created == nil { @@ -31718,6 +31694,30 @@ func (w *WorkflowDispatchEvent) GetWorkflow() string { return *w.Workflow } +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (w *WorkflowDispatchRunDetails) GetHTMLURL() string { + if w == nil || w.HTMLURL == nil { + return "" + } + return *w.HTMLURL +} + +// GetRunURL returns the RunURL field if it's non-nil, zero value otherwise. +func (w *WorkflowDispatchRunDetails) GetRunURL() string { + if w == nil || w.RunURL == nil { + return "" + } + return *w.RunURL +} + +// GetWorkflowRunID returns the WorkflowRunID field if it's non-nil, zero value otherwise. +func (w *WorkflowDispatchRunDetails) GetWorkflowRunID() int64 { + if w == nil || w.WorkflowRunID == nil { + return 0 + } + return *w.WorkflowRunID +} + // GetCheckRunURL returns the CheckRunURL field if it's non-nil, zero value otherwise. func (w *WorkflowJob) GetCheckRunURL() string { if w == nil || w.CheckRunURL == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 7e2ea1686c4..891957bd3e4 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -9406,39 +9406,6 @@ func TestCreateWorkflowDispatchEventRequest_GetReturnRunDetails(tt *testing.T) { c.GetReturnRunDetails() } -func TestCreateWorkflowDispatchEventResponse_GetHTMLURL(tt *testing.T) { - tt.Parallel() - var zeroValue string - c := &CreateWorkflowDispatchEventResponse{HTMLURL: &zeroValue} - c.GetHTMLURL() - c = &CreateWorkflowDispatchEventResponse{} - c.GetHTMLURL() - c = nil - c.GetHTMLURL() -} - -func TestCreateWorkflowDispatchEventResponse_GetRunURL(tt *testing.T) { - tt.Parallel() - var zeroValue string - c := &CreateWorkflowDispatchEventResponse{RunURL: &zeroValue} - c.GetRunURL() - c = &CreateWorkflowDispatchEventResponse{} - c.GetRunURL() - c = nil - c.GetRunURL() -} - -func TestCreateWorkflowDispatchEventResponse_GetWorkflowRunID(tt *testing.T) { - tt.Parallel() - var zeroValue int64 - c := &CreateWorkflowDispatchEventResponse{WorkflowRunID: &zeroValue} - c.GetWorkflowRunID() - c = &CreateWorkflowDispatchEventResponse{} - c.GetWorkflowRunID() - c = nil - c.GetWorkflowRunID() -} - func TestCreationInfo_GetCreated(tt *testing.T) { tt.Parallel() var zeroValue Timestamp @@ -40956,6 +40923,39 @@ func TestWorkflowDispatchEvent_GetWorkflow(tt *testing.T) { w.GetWorkflow() } +func TestWorkflowDispatchRunDetails_GetHTMLURL(tt *testing.T) { + tt.Parallel() + var zeroValue string + w := &WorkflowDispatchRunDetails{HTMLURL: &zeroValue} + w.GetHTMLURL() + w = &WorkflowDispatchRunDetails{} + w.GetHTMLURL() + w = nil + w.GetHTMLURL() +} + +func TestWorkflowDispatchRunDetails_GetRunURL(tt *testing.T) { + tt.Parallel() + var zeroValue string + w := &WorkflowDispatchRunDetails{RunURL: &zeroValue} + w.GetRunURL() + w = &WorkflowDispatchRunDetails{} + w.GetRunURL() + w = nil + w.GetRunURL() +} + +func TestWorkflowDispatchRunDetails_GetWorkflowRunID(tt *testing.T) { + tt.Parallel() + var zeroValue int64 + w := &WorkflowDispatchRunDetails{WorkflowRunID: &zeroValue} + w.GetWorkflowRunID() + w = &WorkflowDispatchRunDetails{} + w.GetWorkflowRunID() + w = nil + w.GetWorkflowRunID() +} + func TestWorkflowJob_GetCheckRunURL(tt *testing.T) { tt.Parallel() var zeroValue string