feat(api): add Run.name, the GitHub name of a run
- commit
- 5a86d44af445dc946b0b5b65eebc6e09d8f56911
- author
- brice · · 2026-10-13 03:32 UTC
- parent
- f8f6441
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +60 -9
M gen/ermite/run.pb.go +25 -6 generated file: collapsed
M gen_test.go +21 -0
| @@ -329,3 +329,24 @@ func TestCompleteJobRoundTrip(t *testing.T) { | |||
| 329 | 329 | t.Errorf("unexpected response %v", r) | |
| 330 | 330 | } | |
| 331 | 331 | } | |
| 332 | + | ||
| 333 | + | // TestRunNameField pins the number of Run.name, the GitHub name of the run | |
| 334 | + | // that sits next to workflow_name, and that it survives the wire. | |
| 335 | + | func TestRunNameField(t *testing.T) { | |
| 336 | + | fd := (&ermite.Run{}).ProtoReflect().Descriptor().Fields().ByName("name") | |
| 337 | + | if fd == nil || fd.Number() != 19 { | |
| 338 | + | t.Fatalf("Run.name = %v, want field 19", fd) | |
| 339 | + | } | |
| 340 | + | in := &ermite.Run{WorkflowName: "Names Workflow", Name: "run push on branch by someone", Title: "run push on branch by someone"} | |
| 341 | + | b, err := proto.Marshal(in) | |
| 342 | + | if err != nil { | |
| 343 | + | t.Fatal(err) | |
| 344 | + | } | |
| 345 | + | var out ermite.Run | |
| 346 | + | if err := proto.Unmarshal(b, &out); err != nil { | |
| 347 | + | t.Fatal(err) | |
| 348 | + | } | |
| 349 | + | if out.GetName() != in.GetName() || out.GetWorkflowName() != "Names Workflow" { | |
| 350 | + | t.Errorf("round trip: name %q, workflow_name %q", out.GetName(), out.GetWorkflowName()) | |
| 351 | + | } | |
| 352 | + | } | |
| @@ -329,3 +329,24 @@ func TestCompleteJobRoundTrip(t *testing.T) { | |||||
| 329 | t.Errorf("unexpected response %v", r) | 329 | t.Errorf("unexpected response %v", r) | ||
| 330 | } | 330 | } | ||
| 331 | } | 331 | } | ||
| 332 | + | ||||
| 333 | + | // TestRunNameField pins the number of Run.name, the GitHub name of the run | |||
| 334 | + | // that sits next to workflow_name, and that it survives the wire. | |||
| 335 | + | func TestRunNameField(t *testing.T) { | |||
| 336 | + | fd := (&ermite.Run{}).ProtoReflect().Descriptor().Fields().ByName("name") | |||
| 337 | + | if fd == nil || fd.Number() != 19 { | |||
| 338 | + | t.Fatalf("Run.name = %v, want field 19", fd) | |||
| 339 | + | } | |||
| 340 | + | in := &ermite.Run{WorkflowName: "Names Workflow", Name: "run push on branch by someone", Title: "run push on branch by someone"} | |||
| 341 | + | b, err := proto.Marshal(in) | |||
| 342 | + | if err != nil { | |||
| 343 | + | t.Fatal(err) | |||
| 344 | + | } | |||
| 345 | + | var out ermite.Run | |||
| 346 | + | if err := proto.Unmarshal(b, &out); err != nil { | |||
| 347 | + | t.Fatal(err) | |||
| 348 | + | } | |||
| 349 | + | if out.GetName() != in.GetName() || out.GetWorkflowName() != "Names Workflow" { | |||
| 350 | + | t.Errorf("round trip: name %q, workflow_name %q", out.GetName(), out.GetWorkflowName()) | |||
| 351 | + | } | |||
| 352 | + | } | |||
M proto/ermite/run.proto +14 -3
| @@ -27,10 +27,14 @@ message Run { | |||
| 27 | 27 | // ".github/workflows/ci.yml". | |
| 28 | 28 | string workflow_path = 5; | |
| 29 | 29 | // WorkflowName is the "name" of the workflow, or workflow_path when it has | |
| 30 | - | // none (as GitHub does). | |
| 30 | + | // none (as GitHub does). It is the "github.workflow" of the run and the | |
| 31 | + | // workflow name of its checks. See name for the name of the run itself. | |
| 31 | 32 | string workflow_name = 6; | |
| 32 | - | // Title is the first line of the message of the commit sha, at most 256 | |
| 33 | - | // characters (GitHub's display title). | |
| 33 | + | // Title is GitHub's display title, at most 256 characters: the evaluated | |
| 34 | + | // "run-name" of the workflow when it has one, else for a push to a branch | |
| 35 | + | // the first line of the message of the commit sha, and for a push of a tag | |
| 36 | + | // the name of the workflow registered for workflow_path (the "name" of that | |
| 37 | + | // file on the default branch, else workflow_name). | |
| 34 | 38 | string title = 7; | |
| 35 | 39 | // Event is the event that triggered the run, in GitHub's name: "push" (the | |
| 36 | 40 | // only one for now; push to a branch or a tag, and merge of a merge | |
| @@ -73,6 +77,13 @@ message Run { | |||
| 73 | 77 | // not delivered in order, and a client that holds two copies of a run keeps | |
| 74 | 78 | // the one with the higher version and drops the other. | |
| 75 | 79 | int64 version = 18; | |
| 80 | + | // Name is the name of the run, GitHub's "name" of a workflow run: the | |
| 81 | + | // evaluated "run-name" of the workflow when it has one, else the same value | |
| 82 | + | // as workflow_name. It is what GitHub lists as the run's name, whereas | |
| 83 | + | // workflow_name stays the name of the workflow ("github.workflow") even when | |
| 84 | + | // the workflow has a "run-name". A run stored before this field existed | |
| 85 | + | // reads as workflow_name. | |
| 86 | + | string name = 19; | |
| 76 | 87 | } | |
| 77 | 88 | ||
| 78 | 89 | // RunJob is a job of a run as people see it: the state of one job instance | |
| @@ -27,10 +27,14 @@ message Run { | |||||
| 27 | // ".github/workflows/ci.yml". | 27 | // ".github/workflows/ci.yml". | ||
| 28 | string workflow_path = 5; | 28 | string workflow_path = 5; | ||
| 29 | // WorkflowName is the "name" of the workflow, or workflow_path when it has | 29 | // WorkflowName is the "name" of the workflow, or workflow_path when it has | ||
| 30 | - | // none (as GitHub does). | 30 | + | // none (as GitHub does). It is the "github.workflow" of the run and the |
| 31 | + | // workflow name of its checks. See name for the name of the run itself. | |||
| 31 | string workflow_name = 6; | 32 | string workflow_name = 6; | ||
| 32 | - | // Title is the first line of the message of the commit sha, at most 256 | 33 | + | // Title is GitHub's display title, at most 256 characters: the evaluated |
| 33 | - | // characters (GitHub's display title). | 34 | + | // "run-name" of the workflow when it has one, else for a push to a branch |
| 35 | + | // the first line of the message of the commit sha, and for a push of a tag | |||
| 36 | + | // the name of the workflow registered for workflow_path (the "name" of that | |||
| 37 | + | // file on the default branch, else workflow_name). | |||
| 34 | string title = 7; | 38 | string title = 7; | ||
| 35 | // Event is the event that triggered the run, in GitHub's name: "push" (the | 39 | // Event is the event that triggered the run, in GitHub's name: "push" (the | ||
| 36 | // only one for now; push to a branch or a tag, and merge of a merge | 40 | // only one for now; push to a branch or a tag, and merge of a merge | ||
| @@ -73,6 +77,13 @@ message Run { | |||||
| 73 | // not delivered in order, and a client that holds two copies of a run keeps | 77 | // not delivered in order, and a client that holds two copies of a run keeps | ||
| 74 | // the one with the higher version and drops the other. | 78 | // the one with the higher version and drops the other. | ||
| 75 | int64 version = 18; | 79 | int64 version = 18; | ||
| 80 | + | // Name is the name of the run, GitHub's "name" of a workflow run: the | |||
| 81 | + | // evaluated "run-name" of the workflow when it has one, else the same value | |||
| 82 | + | // as workflow_name. It is what GitHub lists as the run's name, whereas | |||
| 83 | + | // workflow_name stays the name of the workflow ("github.workflow") even when | |||
| 84 | + | // the workflow has a "run-name". A run stored before this field existed | |||
| 85 | + | // reads as workflow_name. | |||
| 86 | + | string name = 19; | |||
| 76 | } | 87 | } | ||
| 77 | 88 | ||||
| 78 | // RunJob is a job of a run as people see it: the state of one job instance | 89 | // RunJob is a job of a run as people see it: the state of one job instance | ||