+
Skip to content

feat: Add missing github enterprise importer and domains meta fields #3121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions github/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ type MetaService service

// APIMeta represents metadata about the GitHub API.
type APIMeta struct {
// An Array of IP addresses in CIDR format specifying the addresses
// An array of IP addresses in CIDR format specifying the addresses
// that incoming service hooks will originate from on GitHub.com.
Hooks []string `json:"hooks,omitempty"`

// An Array of IP addresses in CIDR format specifying the Git servers
// An array of IP addresses in CIDR format specifying the Git servers
// for GitHub.com.
Git []string `json:"git,omitempty"`

Expand All @@ -40,10 +40,14 @@ type APIMeta struct {
// which serve GitHub Pages websites.
Pages []string `json:"pages,omitempty"`

// An Array of IP addresses specifying the addresses that source imports
// An array of IP addresses specifying the addresses that source imports
// will originate from on GitHub.com.
Importer []string `json:"importer,omitempty"`

// An array of IP addresses specifying the addresses that source imports
// will originate from on GitHub Enterprise Cloud.
GithubEnterpriseImporter []string `json:"github_enterprise_importer,omitempty"`

// An array of IP addresses in CIDR format specifying the IP addresses
// GitHub Actions will originate from.
Actions []string `json:"actions,omitempty"`
Expand All @@ -65,6 +69,10 @@ type APIMeta struct {
// An array of IP addresses in CIDR format specifying the addresses
// which serve GitHub APIs.
API []string `json:"api,omitempty"`

// A map of GitHub services and their associated domains. Note that many
// of these domains are represented as wildcards (e.g. "*.github.com").
Domains map[string][]string `json:"domains,omitempty"`
}

// Get returns information about GitHub.com, the service. Or, if you access
Expand Down
30 changes: 20 additions & 10 deletions github/meta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,31 @@ func TestAPIMeta_Marshal(t *testing.T) {
VerifiablePasswordAuthentication: Bool(true),
Pages: []string{"p"},
Importer: []string{"i"},
GithubEnterpriseImporter: []string{"gei"},
Actions: []string{"a"},
Dependabot: []string{"d"},
SSHKeyFingerprints: map[string]string{"a": "f"},
SSHKeys: []string{"k"},
API: []string{"a"},
Web: []string{"w"},
Domains: map[string][]string{
"example": {"example.com", "*.example.com"},
},
}
want := `{
"hooks":["h"],
"git":["g"],
"verifiable_password_authentication":true,
"pages":["p"],
"importer":["i"],
"github_enterprise_importer":["gei"],
"actions":["a"],
"dependabot":["d"],
"ssh_key_fingerprints":{"a":"f"},
"ssh_keys":["k"],
"api":["a"],
"web":["w"]
"web":["w"],
"domains":{"example":["example.com","*.example.com"]}
}`

testJSONMarshal(t, a, want)
Expand All @@ -53,7 +59,7 @@ func TestMetaService_Get(t *testing.T) {

mux.HandleFunc("/meta", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
fmt.Fprint(w, `{"web":["w"],"api":["a"],"hooks":["h"], "git":["g"], "pages":["p"], "importer":["i"], "actions":["a"], "dependabot":["d"], "verifiable_password_authentication": true}`)
fmt.Fprint(w, `{"web":["w"],"api":["a"],"hooks":["h"], "git":["g"], "pages":["p"], "importer":["i"], "github_enterprise_importer": ["gei"], "actions":["a"], "dependabot":["d"], "verifiable_password_authentication": true, "domains":{"example":["example.com","*.example.com"]}}`)
})

ctx := context.Background()
Expand All @@ -63,14 +69,18 @@ func TestMetaService_Get(t *testing.T) {
}

want := &APIMeta{
Hooks: []string{"h"},
Git: []string{"g"},
Pages: []string{"p"},
Importer: []string{"i"},
Actions: []string{"a"},
Dependabot: []string{"d"},
API: []string{"a"},
Web: []string{"w"},
Hooks: []string{"h"},
Git: []string{"g"},
Pages: []string{"p"},
Importer: []string{"i"},
GithubEnterpriseImporter: []string{"gei"},
Actions: []string{"a"},
Dependabot: []string{"d"},
API: []string{"a"},
Web: []string{"w"},
Domains: map[string][]string{
"example": {"example.com", "*.example.com"},
},

VerifiablePasswordAuthentication: Bool(true),
}
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载