Skip to content

Commit 2a3e0b0

Browse files
committed
feat: allow users to set GitHub app in their repositories
Signed-off-by: Ludovic Ortega <ludovic.ortega@adminafk.fr>
1 parent e72a4fb commit 2a3e0b0

6 files changed

+8
-28
lines changed

github/resource_github_app_installation_repositories.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,6 @@ func resourceGithubAppInstallationRepositoriesDelete(d *schema.ResourceData, met
157157
}
158158

159159
func getAllAccessibleRepos(meta any, idString string) (map[string]int64, int64, error) {
160-
err := checkOrganization(meta)
161-
if err != nil {
162-
return nil, 0, err
163-
}
164-
165160
installationID, err := strconv.ParseInt(idString, 10, 64)
166161
if err != nil {
167162
return nil, 0, unconvertibleIdErr(idString, err)

github/resource_github_app_installation_repositories_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func TestAccGithubAppInstallationRepositories(t *testing.T) {
6767
})
6868

6969
t.Run("with an individual account", func(t *testing.T) {
70-
t.Skip("individual account not supported for this operation")
70+
testCase(t, individual)
7171
})
7272

7373
t.Run("with an organization account", func(t *testing.T) {

github/resource_github_app_installation_repository.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ func resourceGithubAppInstallationRepository() *schema.Resource {
4040
}
4141

4242
func resourceGithubAppInstallationRepositoryCreate(d *schema.ResourceData, meta any) error {
43-
err := checkOrganization(meta)
44-
if err != nil {
45-
return err
46-
}
47-
4843
installationIDString := d.Get("installation_id").(string)
4944
installationID, err := strconv.ParseInt(installationIDString, 10, 64)
5045
if err != nil {
@@ -71,11 +66,6 @@ func resourceGithubAppInstallationRepositoryCreate(d *schema.ResourceData, meta
7166
}
7267

7368
func resourceGithubAppInstallationRepositoryRead(d *schema.ResourceData, meta any) error {
74-
err := checkOrganization(meta)
75-
if err != nil {
76-
return err
77-
}
78-
7969
client := meta.(*Owner).v3client
8070
installationIDString, repoName, err := parseTwoPartID(d.Id(), "installation_id", "repository")
8171
if err != nil {
@@ -124,11 +114,6 @@ func resourceGithubAppInstallationRepositoryRead(d *schema.ResourceData, meta an
124114
}
125115

126116
func resourceGithubAppInstallationRepositoryDelete(d *schema.ResourceData, meta any) error {
127-
err := checkOrganization(meta)
128-
if err != nil {
129-
return err
130-
}
131-
132117
installationIDString := d.Get("installation_id").(string)
133118
installationID, err := strconv.ParseInt(installationIDString, 10, 64)
134119
if err != nil {

github/resource_github_app_installation_repository_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func TestAccGithubAppInstallationRepository(t *testing.T) {
6161
})
6262

6363
t.Run("with an individual account", func(t *testing.T) {
64-
t.Skip("individual account not supported for this operation")
64+
testCase(t, individual)
6565
})
6666

6767
t.Run("with an organization account", func(t *testing.T) {

website/docs/r/app_installation_repositories.html.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ description: |-
1010
~> **Note**: This resource is not compatible with the GitHub App Installation authentication method.
1111

1212
This resource manages relationships between app installations and repositories
13-
in your GitHub organization.
13+
in your GitHub organization or your user account.
1414

1515
Creating this resource installs a particular app on multiple repositories.
1616

1717
The app installation and the repositories must all belong to the same
18-
organization on GitHub. Note: you can review your organization's installations
18+
organization or user account on GitHub. Note: you can review your organization's installations
1919
by the following the instructions at this
20-
[link](https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/reviewing-your-organizations-installed-integrations).
20+
[link](https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/reviewing-your-organizations-installed-integrations) or for your user account at this [link](https://docs.github.com/en/apps/using-github-apps/reviewing-and-modifying-installed-github-apps).
2121

2222
## Example Usage
2323

website/docs/r/app_installation_repository.html.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ description: |-
1010
~> **Note**: This resource is not compatible with the GitHub App Installation authentication method.
1111

1212
This resource manages relationships between app installations and repositories
13-
in your GitHub organization.
13+
in your GitHub organization or your user account.
1414

1515
Creating this resource installs a particular app on a particular repository.
1616

1717
The app installation and the repository must both belong to the same
18-
organization on GitHub. Note: you can review your organization's installations
18+
organization or user account on GitHub. Note: you can review your organization's installations
1919
by the following the instructions at this
20-
[link](https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/reviewing-your-organizations-installed-integrations).
20+
[link](https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/reviewing-your-organizations-installed-integrations) or for your user account at this [link](https://docs.github.com/en/apps/using-github-apps/reviewing-and-modifying-installed-github-apps).
2121

2222
## Example Usage
2323

0 commit comments

Comments
 (0)