Skip to content

Commit 5edd2ee

Browse files
authored
feat: Add fields Codespaces, Copilot and ActionsInbound to APIMeta (#3975)
1 parent 879c78f commit 5edd2ee

4 files changed

Lines changed: 38 additions & 1 deletion

File tree

github/github-accessors.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/meta.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ type APIMeta struct {
5656
// GitHub Action macOS runner will originate from.
5757
ActionsMacos []string `json:"actions_macos,omitempty"`
5858

59+
// An array of IP addresses in CIDR format specifying the IP addresses
60+
// GitHub Codespaces will originate from.
61+
Codespaces []string `json:"codespaces,omitempty"`
62+
63+
// An array of IP addresses in CIDR format specifying the IP addresses
64+
// GitHub Copilot will originate from.
65+
Copilot []string `json:"copilot,omitempty"`
66+
5967
// An array of IP addresses in CIDR format specifying the IP addresses
6068
// Dependabot will originate from.
6169
Dependabot []string `json:"dependabot,omitempty"`
@@ -86,9 +94,16 @@ type APIMetaDomains struct {
8694
Copilot []string `json:"copilot,omitempty"`
8795
Packages []string `json:"packages,omitempty"`
8896
Actions []string `json:"actions,omitempty"`
97+
ActionsInbound *ActionsInboundDomains `json:"actions_inbound,omitempty"`
8998
ArtifactAttestations *APIMetaArtifactAttestations `json:"artifact_attestations,omitempty"`
9099
}
91100

101+
// ActionsInboundDomains represents the domains associated with GitHub Actions inbound traffic.
102+
type ActionsInboundDomains struct {
103+
FullDomains []string `json:"full_domains,omitempty"`
104+
WildcardDomains []string `json:"wildcard_domains,omitempty"`
105+
}
106+
92107
// APIMetaArtifactAttestations represents the artifact attestation services domains.
93108
type APIMetaArtifactAttestations struct {
94109
TrustDomain string `json:"trust_domain,omitempty"`

github/meta_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func TestMetaService_Get(t *testing.T) {
7676

7777
mux.HandleFunc("/meta", func(w http.ResponseWriter, r *http.Request) {
7878
testMethod(t, r, "GET")
79-
fmt.Fprint(w, `{"web":["w"],"api":["a"],"hooks":["h"], "git":["g"], "pages":["p"], "importer":["i"], "github_enterprise_importer": ["gei"], "actions":["a"], "actions_macos": ["example.com/1", "example.com/2"], "dependabot":["d"], "verifiable_password_authentication": true, "domains":{"website":["*.github.com","*.github.dev","*.github.io","*.example.com/assets","*.example.com"],"artifact_attestations":{"trust_domain":"","services":["*.actions.github.com","tuf-repo.github.com","fulcio.github.com","timestamp.github.com"]}}}`)
79+
fmt.Fprint(w, `{"web":["w"],"api":["a"],"hooks":["h"], "git":["g"], "pages":["p"], "importer":["i"], "github_enterprise_importer": ["gei"], "actions":["a"], "actions_macos": ["example.com/1", "example.com/2"], "codespaces": ["cs"], "copilot": ["c"], "dependabot":["d"], "verifiable_password_authentication": true, "domains":{"actions_inbound": { "full_domains": ["github.com"], "wildcard_domains": ["*.github.com"]},"website":["*.github.com","*.github.dev","*.github.io","*.example.com/assets","*.example.com"],"artifact_attestations":{"trust_domain":"","services":["*.actions.github.com","tuf-repo.github.com","fulcio.github.com","timestamp.github.com"]}}}`)
8080
})
8181

8282
ctx := t.Context()
@@ -93,6 +93,8 @@ func TestMetaService_Get(t *testing.T) {
9393
GithubEnterpriseImporter: []string{"gei"},
9494
Actions: []string{"a"},
9595
ActionsMacos: []string{"example.com/1", "example.com/2"},
96+
Codespaces: []string{"cs"},
97+
Copilot: []string{"c"},
9698
Dependabot: []string{"d"},
9799
API: []string{"a"},
98100
Web: []string{"w"},
@@ -113,6 +115,10 @@ func TestMetaService_Get(t *testing.T) {
113115
"timestamp.github.com",
114116
},
115117
},
118+
ActionsInbound: &ActionsInboundDomains{
119+
FullDomains: []string{"github.com"},
120+
WildcardDomains: []string{"*.github.com"},
121+
},
116122
},
117123

118124
VerifiablePasswordAuthentication: Ptr(true),

0 commit comments

Comments
 (0)