Skip to content

Commit 0728783

Browse files
committed
feat: Add additional fields and descriptions to github_organization_app_installations data source
Signed-off-by: atilsensalduz <[email protected]>
1 parent a18f2df commit 0728783

3 files changed

Lines changed: 32 additions & 4 deletions

github/data_source_github_organization_app_installations.go

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func dataSourceGithubOrganizationAppInstallations() *schema.Resource {
2525
Computed: true,
2626
Description: "The ID of the GitHub App installation.",
2727
},
28-
"slug": {
28+
"app_slug": {
2929
Type: schema.TypeString,
3030
Computed: true,
3131
Description: "The URL-friendly name of the GitHub App.",
@@ -77,6 +77,22 @@ func dataSourceGithubOrganizationAppInstallations() *schema.Resource {
7777
Computed: true,
7878
Description: "Whether the GitHub App installation is currently suspended.",
7979
},
80+
"single_file_paths": {
81+
Type: schema.TypeList,
82+
Computed: true,
83+
Elem: &schema.Schema{Type: schema.TypeString},
84+
Description: "The list of single file paths the GitHub App installation has access to.",
85+
},
86+
"created_at": {
87+
Type: schema.TypeString,
88+
Computed: true,
89+
Description: "The date the GitHub App installation was created.",
90+
},
91+
"updated_at": {
92+
Type: schema.TypeString,
93+
Computed: true,
94+
Description: "The date the GitHub App installation was last updated.",
95+
},
8096
},
8197
},
8298
},
@@ -128,7 +144,7 @@ func flattenGitHubAppInstallations(orgAppInstallations []*github.Installation) [
128144
result := make(map[string]any)
129145

130146
result["id"] = appInstallation.GetID()
131-
result["slug"] = appInstallation.GetAppSlug()
147+
result["app_slug"] = appInstallation.GetAppSlug()
132148
result["app_id"] = appInstallation.GetAppID()
133149
result["repository_selection"] = appInstallation.GetRepositorySelection()
134150
result["html_url"] = appInstallation.GetHTMLURL()
@@ -144,6 +160,15 @@ func flattenGitHubAppInstallations(orgAppInstallations []*github.Installation) [
144160

145161
result["permissions"] = flattenInstallationPermissions(appInstallation.Permissions)
146162

163+
if appInstallation.SingleFilePaths != nil {
164+
result["single_file_paths"] = appInstallation.SingleFilePaths
165+
} else {
166+
result["single_file_paths"] = []string{}
167+
}
168+
169+
result["created_at"] = appInstallation.GetCreatedAt().Format("2006-01-02T15:04:05Z")
170+
result["updated_at"] = appInstallation.GetUpdatedAt().Format("2006-01-02T15:04:05Z")
171+
147172
results = append(results, result)
148173
}
149174

github/data_source_github_organization_app_installations_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func TestAccGithubOrganizationAppInstallations(t *testing.T) {
1717
Config: config,
1818
Check: resource.ComposeAggregateTestCheckFunc(
1919
resource.TestCheckResourceAttrSet("data.github_organization_app_installations.test", "installations.0.id"),
20-
resource.TestCheckResourceAttrSet("data.github_organization_app_installations.test", "installations.0.slug"),
20+
resource.TestCheckResourceAttrSet("data.github_organization_app_installations.test", "installations.0.app_slug"),
2121
resource.TestCheckResourceAttrSet("data.github_organization_app_installations.test", "installations.0.app_id"),
2222
),
2323
},

website/docs/d/organization_app_installations.html.markdown

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ data "github_organization_app_installations" "all" {}
2626
The `installation` block consists of:
2727

2828
* `id` - The ID of the GitHub App installation.
29-
* `slug` - The URL-friendly name of the GitHub App.
29+
* `app_slug` - The URL-friendly name of the GitHub App.
3030
* `app_id` - The ID of the GitHub App.
3131
* `repository_selection` - Whether the installation has access to all repositories or only selected ones. Possible values are `all` or `selected`.
3232
* `permissions` - A map of the permissions granted to the GitHub App installation.
@@ -36,3 +36,6 @@ The `installation` block consists of:
3636
* `target_id` - The ID of the account the GitHub App is installed on.
3737
* `target_type` - The type of account the GitHub App is installed on. Possible values are `Organization` or `User`.
3838
* `suspended` - Whether the GitHub App installation is currently suspended.
39+
* `single_file_paths` - The list of single file paths the GitHub App installation has access to.
40+
* `created_at` - The date the GitHub App installation was created.
41+
* `updated_at` - The date the GitHub App installation was last updated.

0 commit comments

Comments
 (0)