Skip to content

Commit 15fff78

Browse files
authored
feat: allow users to set GitHub app in their repositories (#2469)
Signed-off-by: Ludovic Ortega <[email protected]>
1 parent 71bbe3f commit 15fff78

4 files changed

Lines changed: 6 additions & 26 deletions

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_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 {

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)