Repository: google/go-github (go)

Issue:
Support for referenced workflows in WorkflowRun
Hi team, please add referenced_workflows field to the WorkflowRun, see documentation https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28 

```
GET /repos/{owner}/{repo}/actions/runs/{run_id}

{
  "title": "Workflow Run",
  "description": "An invocation of a workflow",
  "type": "object",
  "properties": {
...
    "referenced_workflows": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "title": "Referenced workflow",
        "description": "A workflow referenced/reused by the initial caller workflow",
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "sha": {
            "type": "string"
          },
          "ref": {
            "type": "string"
          }
        },
        "required": [
          "path",
          "sha"
        ]
      }
    }
}
```


Pull request description:
Add referenced workflows to WorkflowRun
Closes #2974

Patch:
diff --git a/github/actions_workflow_runs.go b/github/actions_workflow_runs.go
index 390c26af..d57e4887 100644
--- a/github/actions_workflow_runs.go
+++ b/github/actions_workflow_runs.go
@@ -14,39 +14,40 @@ import (
 
 // WorkflowRun represents a repository action workflow run.
 type WorkflowRun struct {
-	ID                 *int64         `json:"id,omitempty"`
-	Name               *string        `json:"name,omitempty"`
-	NodeID             *string        `json:"node_id,omitempty"`
-	HeadBranch         *string        `json:"head_branch,omitempty"`
-	HeadSHA            *string        `json:"head_sha,omitempty"`
-	RunNumber          *int           `json:"run_number,omitempty"`
-	RunAttempt         *int           `json:"run_attempt,omitempty"`
-	Event              *string        `json:"event,omitempty"`
-	DisplayTitle       *string        `json:"display_title,omitempty"`
-	Status             *string        `json:"status,omitempty"`
-	Conclusion         *string        `json:"conclusion,omitempty"`
-	WorkflowID         *int64         `json:"workflow_id,omitempty"`
-	CheckSuiteID       *int64         `json:"check_suite_id,omitempty"`
-	CheckSuiteNodeID   *string        `json:"check_suite_node_id,omitempty"`
-	URL                *string        `json:"url,omitempty"`
-	HTMLURL            *string        `json:"html_url,omitempty"`
-	PullRequests       []*PullRequest `json:"pull_requests,omitempty"`
-	CreatedAt          *Timestamp     `json:"created_at,omitempty"`
-	UpdatedAt          *Timestamp     `json:"updated_at,omitempty"`
-	RunStartedAt       *Timestamp     `json:"run_started_at,omitempty"`
-	JobsURL            *string        `json:"jobs_url,omitempty"`
-	LogsURL            *string        `json:"logs_url,omitempty"`
-	CheckSuiteURL      *string        `json:"check_suite_url,omitempty"`
-	ArtifactsURL       *string        `json:"artifacts_url,omitempty"`
-	CancelURL          *string        `json:"cancel_url,omitempty"`
-	RerunURL           *string        `json:"rerun_url,omitempty"`
-	PreviousAttemptURL *string        `json:"previous_attempt_url,omitempty"`
-	HeadCommit         *HeadCommit    `json:"head_commit,omitempty"`
-	WorkflowURL        *string        `json:"workflow_url,omitempty"`
-	Repository         *Repository    `json:"repository,omitempty"`
-	HeadRepository     *Repository    `json:"head_repository,omitempty"`
-	Actor              *User          `json:"actor,omitempty"`
-	TriggeringActor    *User          `json:"triggering_actor,omitempty"`
+	ID                  *int64                `json:"id,omitempty"`
+	Name                *string               `json:"name,omitempty"`
+	NodeID              *string               `json:"node_id,omitempty"`
+	HeadBranch          *string               `json:"head_branch,omitempty"`
+	HeadSHA             *string               `json:"head_sha,omitempty"`
+	RunNumber           *int                  `json:"run_number,omitempty"`
+	RunAttempt          *int                  `json:"run_attempt,omitempty"`
+	Event               *string               `json:"event,omitempty"`
+	DisplayTitle        *string               `json:"display_title,omitempty"`
+	Status              *string               `json:"status,omitempty"`
+	Conclusion          *string               `json:"conclusion,omitempty"`
+	WorkflowID          *int64                `json:"workflow_id,omitempty"`
+	CheckSuiteID        *int64                `json:"check_suite_id,omitempty"`
+	CheckSuiteNodeID    *string               `json:"check_suite_node_id,omitempty"`
+	URL                 *string               `json:"url,omitempty"`
+	HTMLURL             *string               `json:"html_url,omitempty"`
+	PullRequests        []*PullRequest        `json:"pull_requests,omitempty"`
+	CreatedAt           *Timestamp            `json:"created_at,omitempty"`
+	UpdatedAt           *Timestamp            `json:"updated_at,omitempty"`
+	RunStartedAt        *Timestamp            `json:"run_started_at,omitempty"`
+	JobsURL             *string               `json:"jobs_url,omitempty"`
+	LogsURL             *string               `json:"logs_url,omitempty"`
+	CheckSuiteURL       *string               `json:"check_suite_url,omitempty"`
+	ArtifactsURL        *string               `json:"artifacts_url,omitempty"`
+	CancelURL           *string               `json:"cancel_url,omitempty"`
+	RerunURL            *string               `json:"rerun_url,omitempty"`
+	PreviousAttemptURL  *string               `json:"previous_attempt_url,omitempty"`
+	HeadCommit          *HeadCommit           `json:"head_commit,omitempty"`
+	WorkflowURL         *string               `json:"workflow_url,omitempty"`
+	Repository          *Repository           `json:"repository,omitempty"`
+	HeadRepository      *Repository           `json:"head_repository,omitempty"`
+	Actor               *User                 `json:"actor,omitempty"`
+	TriggeringActor     *User                 `json:"triggering_actor,omitempty"`
+	ReferencedWorkflows []*ReferencedWorkflow `json:"referenced_workflows,omitempty"`
 }
 
 // WorkflowRuns represents a slice of repository action workflow run.
@@ -104,6 +105,12 @@ type PendingDeploymentsRequest struct {
 	Comment string `json:"comment"`
 }
 
+type ReferencedWorkflow struct {
+	Path *string `json:"path,omitempty"`
+	SHA  *string `json:"sha,omitempty"`
+	Ref  *string `json:"ref,omitempty"`
+}
+
 func (s *ActionsService) listWorkflowRuns(ctx context.Context, endpoint string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) {
 	u, err := addOptions(endpoint, opts)
 	if err != nil {
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 199c9b8a..fc79d01d 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -17710,6 +17710,30 @@ func (r *Reference) GetURL() string {
 	return *r.URL
 }
 
+// GetPath returns the Path field if it's non-nil, zero value otherwise.
+func (r *ReferencedWorkflow) GetPath() string {
+	if r == nil || r.Path == nil {
+		return ""
+	}
+	return *r.Path
+}
+
+// GetRef returns the Ref field if it's non-nil, zero value otherwise.
+func (r *ReferencedWorkflow) GetRef() string {
+	if r == nil || r.Ref == nil {
+		return ""
+	}
+	return *r.Ref
+}
+
+// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
+func (r *ReferencedWorkflow) GetSHA() string {
+	if r == nil || r.SHA == nil {
+		return ""
+	}
+	return *r.SHA
+}
+
 // GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise.
 func (r *RegistrationToken) GetExpiresAt() Timestamp {
 	if r == nil || r.ExpiresAt == nil {


Test patch:
diff --git a/github/actions_workflow_runs_test.go b/github/actions_workflow_runs_test.go
index 8a573c20..b4b1c917 100644
--- a/github/actions_workflow_runs_test.go
+++ b/github/actions_workflow_runs_test.go
@@ -761,6 +761,13 @@ func TestWorkflowRun_Marshal(t *testing.T) {
 			SuspendedAt:     &Timestamp{referenceTime},
 			URL:             String("u2"),
 		},
+		ReferencedWorkflows: []*ReferencedWorkflow{
+			{
+				Path: String("rwfp"),
+				SHA:  String("rwfsha"),
+				Ref:  String("rwfref"),
+			},
+		},
 	}
 
 	want := `{
@@ -881,7 +888,14 @@ func TestWorkflowRun_Marshal(t *testing.T) {
 			"created_at": ` + referenceTimeStr + `,
 			"suspended_at": ` + referenceTimeStr + `,
 			"url": "u2"
-		}
+		},
+		"referenced_workflows": [
+			{
+				"path": "rwfp",
+				"sha": "rwfsha",
+				"ref": "rwfref"
+			}
+		]
 	}`
 
 	testJSONMarshal(t, u, want)
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index d179a927..ff4a49d7 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -20521,6 +20521,36 @@ func TestReference_GetURL(tt *testing.T) {
 	r.GetURL()
 }
 
+func TestReferencedWorkflow_GetPath(tt *testing.T) {
+	var zeroValue string
+	r := &ReferencedWorkflow{Path: &zeroValue}
+	r.GetPath()
+	r = &ReferencedWorkflow{}
+	r.GetPath()
+	r = nil
+	r.GetPath()
+}
+
+func TestReferencedWorkflow_GetRef(tt *testing.T) {
+	var zeroValue string
+	r := &ReferencedWorkflow{Ref: &zeroValue}
+	r.GetRef()
+	r = &ReferencedWorkflow{}
+	r.GetRef()
+	r = nil
+	r.GetRef()
+}
+
+func TestReferencedWorkflow_GetSHA(tt *testing.T) {
+	var zeroValue string
+	r := &ReferencedWorkflow{SHA: &zeroValue}
+	r.GetSHA()
+	r = &ReferencedWorkflow{}
+	r.GetSHA()
+	r = nil
+	r.GetSHA()
+}
+
 func TestRegistrationToken_GetExpiresAt(tt *testing.T) {
 	var zeroValue Timestamp
 	r := &RegistrationToken{ExpiresAt: &zeroValue}