Repository: google/go-github
Pull request #2671 (2023-02-23 20:24:56)

Add created_at to WorkflowJob struct
`created_at` was recently added to `workflow_job` 

https://github.com/actions/runner/issues/1881

google-cla[bot]: Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this [failed invocation](https://github.com/google/go-github/pull/2671/checks?check_run_id=11559851027) of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Patch:
diff --git a/github/actions_workflow_jobs.go b/github/actions_workflow_jobs.go
index b55f9aa7..b7130916 100644
--- a/github/actions_workflow_jobs.go
+++ b/github/actions_workflow_jobs.go
@@ -33,6 +33,7 @@ type WorkflowJob struct {
 	HTMLURL     *string     `json:"html_url,omitempty"`
 	Status      *string     `json:"status,omitempty"`
 	Conclusion  *string     `json:"conclusion,omitempty"`
+	CreatedAt   *Timestamp  `json:"created_at,omitempty"`
 	StartedAt   *Timestamp  `json:"started_at,omitempty"`
 	CompletedAt *Timestamp  `json:"completed_at,omitempty"`
 	Name        *string     `json:"name,omitempty"`
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 59a59a4e..a7d800e2 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -21006,6 +21006,14 @@ func (w *WorkflowJob) GetConclusion() string {
 	return *w.Conclusion
 }
 
+// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
+func (w *WorkflowJob) GetCreatedAt() Timestamp {
+	if w == nil || w.CreatedAt == nil {
+		return Timestamp{}
+	}
+	return *w.CreatedAt
+}
+
 // GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise.
 func (w *WorkflowJob) GetHeadSHA() string {
 	if w == nil || w.HeadSHA == nil {


Test patch:
diff --git a/github/actions_workflow_jobs_test.go b/github/actions_workflow_jobs_test.go
index da52619a..521e4011 100644
--- a/github/actions_workflow_jobs_test.go
+++ b/github/actions_workflow_jobs_test.go
@@ -251,6 +251,7 @@ func TestWorkflowJob_Marshal(t *testing.T) {
 		HTMLURL:     String("h"),
 		Status:      String("s"),
 		Conclusion:  String("c"),
+		CreatedAt:   &Timestamp{referenceTime},
 		StartedAt:   &Timestamp{referenceTime},
 		CompletedAt: &Timestamp{referenceTime},
 		Name:        String("n"),
@@ -278,6 +279,7 @@ func TestWorkflowJob_Marshal(t *testing.T) {
 		"html_url": "h",
 		"status": "s",
 		"conclusion": "c",
+		"created_at": ` + referenceTimeStr + `,
 		"started_at": ` + referenceTimeStr + `,
 		"completed_at": ` + referenceTimeStr + `,
 		"name": "n",
@@ -312,6 +314,7 @@ func TestJobs_Marshal(t *testing.T) {
 				HTMLURL:     String("h"),
 				Status:      String("s"),
 				Conclusion:  String("c"),
+				CreatedAt:   &Timestamp{referenceTime},
 				StartedAt:   &Timestamp{referenceTime},
 				CompletedAt: &Timestamp{referenceTime},
 				Name:        String("n"),
@@ -344,6 +347,7 @@ func TestJobs_Marshal(t *testing.T) {
 			"html_url": "h",
 			"status": "s",
 			"conclusion": "c",
+			"created_at": ` + referenceTimeStr + `,
 			"started_at": ` + referenceTimeStr + `,
 			"completed_at": ` + referenceTimeStr + `,
 			"name": "n",
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index 7239698a..2bd40a94 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -24548,6 +24548,16 @@ func TestWorkflowJob_GetConclusion(tt *testing.T) {
 	w.GetConclusion()
 }
 
+func TestWorkflowJob_GetCreatedAt(tt *testing.T) {
+	var zeroValue Timestamp
+	w := &WorkflowJob{CreatedAt: &zeroValue}
+	w.GetCreatedAt()
+	w = &WorkflowJob{}
+	w.GetCreatedAt()
+	w = nil
+	w.GetCreatedAt()
+}
+
 func TestWorkflowJob_GetHeadSHA(tt *testing.T) {
 	var zeroValue string
 	w := &WorkflowJob{HeadSHA: &zeroValue}