(t *testing.T)
| 312 | } |
| 313 | |
| 314 | func TestWorkflowRunIDFromOutput(t *testing.T) { |
| 315 | tests := []struct { |
| 316 | name string |
| 317 | output string |
| 318 | want string |
| 319 | }{ |
| 320 | { |
| 321 | name: "GitHub.com workflow run URL", |
| 322 | output: "https://github.com/OWNER/REPO/actions/runs/1234\n", |
| 323 | want: "1234", |
| 324 | }, |
| 325 | { |
| 326 | name: "GHEC workflow run URL", |
| 327 | output: "https://example.ghe.com/OWNER/REPO/actions/runs/5678\n", |
| 328 | want: "5678", |
| 329 | }, |
| 330 | { |
| 331 | name: "empty legacy dispatch output", |
| 332 | output: "", |
| 333 | }, |
| 334 | { |
| 335 | name: "unrelated URL", |
| 336 | output: "https://github.com/OWNER/REPO/actions/workflows/main.yml", |
| 337 | }, |
| 338 | { |
| 339 | name: "non-numeric run identifier", |
| 340 | output: "https://github.com/OWNER/REPO/actions/runs/latest", |
| 341 | }, |
| 342 | } |
| 343 | |
| 344 | for _, tt := range tests { |
| 345 | t.Run(tt.name, func(t *testing.T) { |
| 346 | assert.Equal(t, tt.want, workflowRunIDFromOutput(tt.output)) |
| 347 | }) |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | func TestResolveWorkflowRunIDUsesDispatchOutput(t *testing.T) { |
| 352 | runID, err := resolveWorkflowRunID( |
nothing calls this directly
no test coverage detected