Repository: google/go-github
Pull request #1813 (2021-02-26 13:28:58)

Add missing name field from workflow run
Adds the missing name field from workflow runs endpoint.

See docs: https://docs.github.com/en/rest/reference/actions#get-a-workflow-run

codecov[bot]: # [Codecov](https://codecov.io/gh/google/go-github/pull/1813?src=pr&el=h1) Report
> Merging [#1813](https://codecov.io/gh/google/go-github/pull/1813?src=pr&el=desc) (aa9e76e) into [master](https://codecov.io/gh/google/go-github/commit/bff639efb8827d25e4b020e6ae003537028617da?el=desc) (bff639e) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/google/go-github/pull/1813/graphs/tree.svg?width=650&height=150&src=pr&token=EgYjGjZlI0)](https://codecov.io/gh/google/go-github/pull/1813?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #1813   +/-   ##
=======================================
  Coverage   97.59%   97.59%           
=======================================
  Files         100      100           
  Lines        6521     6521           
=======================================
  Hits         6364     6364           
  Misses         85       85           
  Partials       72       72           
```


| [Impacted Files](https://codecov.io/gh/google/go-github/pull/1813?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [github/actions\_workflow\_runs.go](https://codecov.io/gh/google/go-github/pull/1813/diff?src=pr&el=tree#diff-Z2l0aHViL2FjdGlvbnNfd29ya2Zsb3dfcnVucy5nbw==) | `100.00% <ø> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/google/go-github/pull/1813?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/google/go-github/pull/1813?src=pr&el=footer). Last update [bff639e...f01c675](https://codecov.io/gh/google/go-github/pull/1813?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/github/actions_workflow_runs.go b/github/actions_workflow_runs.go
index 4ccb7a6d..64274a3d 100644
--- a/github/actions_workflow_runs.go
+++ b/github/actions_workflow_runs.go
@@ -15,6 +15,7 @@ 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"`
diff --git a/github/github-accessors.go b/github/github-accessors.go
index e6ea3431..4f82cd10 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -15676,6 +15676,14 @@ func (w *WorkflowRun) GetLogsURL() string {
 	return *w.LogsURL
 }
 
+// GetName returns the Name field if it's non-nil, zero value otherwise.
+func (w *WorkflowRun) GetName() string {
+	if w == nil || w.Name == nil {
+		return ""
+	}
+	return *w.Name
+}
+
 // GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
 func (w *WorkflowRun) GetNodeID() string {
 	if w == nil || w.NodeID == nil {


Test patch:
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index 5090e52e..24610c53 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -18384,6 +18384,16 @@ func TestWorkflowRun_GetLogsURL(tt *testing.T) {
 	w.GetLogsURL()
 }
 
+func TestWorkflowRun_GetName(tt *testing.T) {
+	var zeroValue string
+	w := &WorkflowRun{Name: &zeroValue}
+	w.GetName()
+	w = &WorkflowRun{}
+	w.GetName()
+	w = nil
+	w.GetName()
+}
+
 func TestWorkflowRun_GetNodeID(tt *testing.T) {
 	var zeroValue string
 	w := &WorkflowRun{NodeID: &zeroValue}