(t *testing.T)
| 147 | } |
| 148 | |
| 149 | func TestGetGitHubHostForRepo(t *testing.T) { |
| 150 | tests := []struct { |
| 151 | name string |
| 152 | repo string |
| 153 | gheHost string |
| 154 | expectedHost string |
| 155 | }{ |
| 156 | { |
| 157 | name: "non-allowlisted repo uses configured public host", |
| 158 | repo: "owner/repo", |
| 159 | gheHost: "", |
| 160 | expectedHost: "https://github.com", |
| 161 | }, |
| 162 | { |
| 163 | name: "non-allowlisted repo uses GHE host", |
| 164 | repo: "owner/repo", |
| 165 | gheHost: "myorg.ghe.com", |
| 166 | expectedHost: "https://myorg.ghe.com", |
| 167 | }, |
| 168 | { |
| 169 | name: "github/gh-aw always uses public GitHub", |
| 170 | repo: "github/gh-aw", |
| 171 | gheHost: "myorg.ghe.com", |
| 172 | expectedHost: "https://github.com", |
| 173 | }, |
| 174 | { |
| 175 | name: "github/gh-aw with path always uses public GitHub", |
| 176 | repo: "github/gh-aw/workflows/ci-doctor.md", |
| 177 | gheHost: "myorg.ghe.com", |
| 178 | expectedHost: "https://github.com", |
| 179 | }, |
| 180 | { |
| 181 | name: "githubnext/agentics always uses public GitHub", |
| 182 | repo: "githubnext/agentics", |
| 183 | gheHost: "myorg.ghe.com", |
| 184 | expectedHost: "https://github.com", |
| 185 | }, |
| 186 | { |
| 187 | name: "githubnext/agentics with path always uses public GitHub", |
| 188 | repo: "githubnext/agentics/workflows/daily-plan.md", |
| 189 | gheHost: "myorg.ghe.com", |
| 190 | expectedHost: "https://github.com", |
| 191 | }, |
| 192 | { |
| 193 | name: "githubnext/agentics without GHE host uses public GitHub", |
| 194 | repo: "githubnext/agentics", |
| 195 | gheHost: "", |
| 196 | expectedHost: "https://github.com", |
| 197 | }, |
| 198 | { |
| 199 | name: "github org repository always uses public GitHub", |
| 200 | repo: "github/copilot", |
| 201 | gheHost: "myorg.ghe.com", |
| 202 | expectedHost: "https://github.com", |
| 203 | }, |
| 204 | { |
| 205 | name: "microsoft org repository always uses public GitHub", |
| 206 | repo: "microsoft/vscode", |
nothing calls this directly
no test coverage detected