(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestParseGitHubURL_RunURLs(t *testing.T) { |
| 12 | tests := []struct { |
| 13 | name string |
| 14 | url string |
| 15 | wantOwner string |
| 16 | wantRepo string |
| 17 | wantHost string |
| 18 | wantRunID int64 |
| 19 | wantErr bool |
| 20 | }{ |
| 21 | { |
| 22 | name: "Standard run URL with /actions/", |
| 23 | url: "https://github.com/owner/repo/actions/runs/12345678", |
| 24 | wantOwner: "owner", |
| 25 | wantRepo: "repo", |
| 26 | wantHost: "github.com", |
| 27 | wantRunID: 12345678, |
| 28 | wantErr: false, |
| 29 | }, |
| 30 | { |
| 31 | name: "Run URL with job", |
| 32 | url: "https://github.com/owner/repo/actions/runs/12345678/job/98765432", |
| 33 | wantOwner: "owner", |
| 34 | wantRepo: "repo", |
| 35 | wantHost: "github.com", |
| 36 | wantRunID: 12345678, |
| 37 | wantErr: false, |
| 38 | }, |
| 39 | { |
| 40 | name: "Run URL with attempts", |
| 41 | url: "https://github.com/owner/repo/actions/runs/12345678/attempts/2", |
| 42 | wantOwner: "owner", |
| 43 | wantRepo: "repo", |
| 44 | wantHost: "github.com", |
| 45 | wantRunID: 12345678, |
| 46 | wantErr: false, |
| 47 | }, |
| 48 | { |
| 49 | name: "Short run URL without /actions/", |
| 50 | url: "https://github.com/owner/repo/runs/12345678", |
| 51 | wantOwner: "owner", |
| 52 | wantRepo: "repo", |
| 53 | wantHost: "github.com", |
| 54 | wantRunID: 12345678, |
| 55 | wantErr: false, |
| 56 | }, |
| 57 | { |
| 58 | name: "Enterprise run URL", |
| 59 | url: "https://github.example.com/owner/repo/actions/runs/12345678", |
| 60 | wantOwner: "owner", |
| 61 | wantRepo: "repo", |
| 62 | wantHost: "github.example.com", |
| 63 | wantRunID: 12345678, |
| 64 | wantErr: false, |
| 65 | }, |
| 66 | { |
| 67 | name: "Invalid run ID", |
| 68 | url: "https://github.com/owner/repo/actions/runs/notanumber", |
nothing calls this directly
no test coverage detected