Skip to content

Commit 72389c8

Browse files
deigaclaude
andcommitted
feat(ip_ranges): add actions_macos and github_enterprise_importer fields
Add support for the `actions_macos` and `github_enterprise_importer` IP ranges returned by the GitHub Meta API. These fields were missing from the data source but are available in go-github v82's APIMeta struct. New attributes: - actions_macos, actions_macos_ipv4, actions_macos_ipv6 - github_enterprise_importer, github_enterprise_importer_ipv4, github_enterprise_importer_ipv6 Also adds descriptions to the existing actions fields for consistency. Fixes #2607 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent ecd4b0d commit 72389c8

2 files changed

Lines changed: 92 additions & 9 deletions

File tree

github/data_source_github_ip_ranges.go

Lines changed: 86 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,22 @@ func dataSourceGithubIpRanges() *schema.Resource {
4848
Elem: &schema.Schema{Type: schema.TypeString},
4949
},
5050
"actions": {
51-
Type: schema.TypeList,
52-
Computed: true,
53-
Elem: &schema.Schema{Type: schema.TypeString},
51+
Type: schema.TypeList,
52+
Computed: true,
53+
Elem: &schema.Schema{Type: schema.TypeString},
54+
Description: "An array of IP addresses in CIDR format specifying the addresses that GitHub Actions will originate from.",
55+
},
56+
"actions_macos": {
57+
Type: schema.TypeList,
58+
Computed: true,
59+
Elem: &schema.Schema{Type: schema.TypeString},
60+
Description: "An array of IP addresses in CIDR format specifying the addresses that GitHub Actions macOS runners will originate from.",
61+
},
62+
"github_enterprise_importer": {
63+
Type: schema.TypeList,
64+
Computed: true,
65+
Elem: &schema.Schema{Type: schema.TypeString},
66+
Description: "An array of IP addresses in CIDR format specifying the addresses that GitHub Enterprise Importer will originate from.",
5467
},
5568
"dependabot": {
5669
Deprecated: "This attribute is no longer returned form the API, Dependabot now uses the GitHub Actions IP addresses.",
@@ -94,9 +107,22 @@ func dataSourceGithubIpRanges() *schema.Resource {
94107
Elem: &schema.Schema{Type: schema.TypeString},
95108
},
96109
"actions_ipv4": {
97-
Type: schema.TypeList,
98-
Computed: true,
99-
Elem: &schema.Schema{Type: schema.TypeString},
110+
Type: schema.TypeList,
111+
Computed: true,
112+
Elem: &schema.Schema{Type: schema.TypeString},
113+
Description: "An array of IPv4 addresses in CIDR format specifying the addresses that GitHub Actions will originate from.",
114+
},
115+
"actions_macos_ipv4": {
116+
Type: schema.TypeList,
117+
Computed: true,
118+
Elem: &schema.Schema{Type: schema.TypeString},
119+
Description: "An array of IPv4 addresses in CIDR format specifying the addresses that GitHub Actions macOS runners will originate from.",
120+
},
121+
"github_enterprise_importer_ipv4": {
122+
Type: schema.TypeList,
123+
Computed: true,
124+
Elem: &schema.Schema{Type: schema.TypeString},
125+
Description: "An array of IPv4 addresses in CIDR format specifying the addresses that GitHub Enterprise Importer will originate from.",
100126
},
101127
"dependabot_ipv4": {
102128
Deprecated: "This attribute is no longer returned form the API, Dependabot now uses the GitHub Actions IP addresses.",
@@ -140,9 +166,22 @@ func dataSourceGithubIpRanges() *schema.Resource {
140166
Elem: &schema.Schema{Type: schema.TypeString},
141167
},
142168
"actions_ipv6": {
143-
Type: schema.TypeList,
144-
Computed: true,
145-
Elem: &schema.Schema{Type: schema.TypeString},
169+
Type: schema.TypeList,
170+
Computed: true,
171+
Elem: &schema.Schema{Type: schema.TypeString},
172+
Description: "An array of IPv6 addresses in CIDR format specifying the addresses that GitHub Actions will originate from.",
173+
},
174+
"actions_macos_ipv6": {
175+
Type: schema.TypeList,
176+
Computed: true,
177+
Elem: &schema.Schema{Type: schema.TypeString},
178+
Description: "An array of IPv6 addresses in CIDR format specifying the addresses that GitHub Actions macOS runners will originate from.",
179+
},
180+
"github_enterprise_importer_ipv6": {
181+
Type: schema.TypeList,
182+
Computed: true,
183+
Elem: &schema.Schema{Type: schema.TypeString},
184+
Description: "An array of IPv6 addresses in CIDR format specifying the addresses that GitHub Enterprise Importer will originate from.",
146185
},
147186
"dependabot_ipv6": {
148187
Deprecated: "This attribute is no longer returned form the API, Dependabot now uses the GitHub Actions IP addresses.",
@@ -192,6 +231,16 @@ func dataSourceGithubIpRangesRead(d *schema.ResourceData, meta any) error {
192231
return err
193232
}
194233

234+
cidrActionsMacosIpv4, cidrActionsMacosIpv6, err := splitIpv4Ipv6Cidrs(&api.ActionsMacos)
235+
if err != nil {
236+
return err
237+
}
238+
239+
cidrGithubEnterpriseImporterIpv4, cidrGithubEnterpriseImporterIpv6, err := splitIpv4Ipv6Cidrs(&api.GithubEnterpriseImporter)
240+
if err != nil {
241+
return err
242+
}
243+
195244
cidrDependabotIpv4, cidrDependabotIpv6, err := splitIpv4Ipv6Cidrs(&api.Dependabot)
196245
if err != nil {
197246
return err
@@ -285,6 +334,34 @@ func dataSourceGithubIpRangesRead(d *schema.ResourceData, meta any) error {
285334
return err
286335
}
287336
}
337+
if len(api.ActionsMacos) > 0 {
338+
err = d.Set("actions_macos", api.ActionsMacos)
339+
if err != nil {
340+
return err
341+
}
342+
err = d.Set("actions_macos_ipv4", cidrActionsMacosIpv4)
343+
if err != nil {
344+
return err
345+
}
346+
err = d.Set("actions_macos_ipv6", cidrActionsMacosIpv6)
347+
if err != nil {
348+
return err
349+
}
350+
}
351+
if len(api.GithubEnterpriseImporter) > 0 {
352+
err = d.Set("github_enterprise_importer", api.GithubEnterpriseImporter)
353+
if err != nil {
354+
return err
355+
}
356+
err = d.Set("github_enterprise_importer_ipv4", cidrGithubEnterpriseImporterIpv4)
357+
if err != nil {
358+
return err
359+
}
360+
err = d.Set("github_enterprise_importer_ipv6", cidrGithubEnterpriseImporterIpv6)
361+
if err != nil {
362+
return err
363+
}
364+
}
288365
if len(api.Dependabot) > 0 {
289366
err = d.Set("dependabot", api.Dependabot)
290367
if err != nil {

github/data_source_github_ip_ranges_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ func TestAccGithubIpRangesDataSource(t *testing.T) {
1919
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "pages.#"),
2020
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "importer.#"),
2121
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "actions.#"),
22+
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "actions_macos.#"),
23+
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "github_enterprise_importer.#"),
2224
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "hooks_ipv4.#"),
2325
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "git_ipv4.#"),
2426
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "api_ipv4.#"),
@@ -27,6 +29,8 @@ func TestAccGithubIpRangesDataSource(t *testing.T) {
2729
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "pages_ipv4.#"),
2830
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "importer_ipv4.#"),
2931
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "actions_ipv4.#"),
32+
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "actions_macos_ipv4.#"),
33+
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "github_enterprise_importer_ipv4.#"),
3034
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "hooks_ipv6.#"),
3135
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "git_ipv6.#"),
3236
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "api_ipv6.#"),
@@ -35,6 +39,8 @@ func TestAccGithubIpRangesDataSource(t *testing.T) {
3539
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "pages_ipv6.#"),
3640
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "importer_ipv6.#"),
3741
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "actions_ipv6.#"),
42+
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "actions_macos_ipv6.#"),
43+
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "github_enterprise_importer_ipv6.#"),
3844
)
3945

4046
resource.Test(t, resource.TestCase{

0 commit comments

Comments
 (0)