Skip to content

Commit

Permalink
feat: allow users to set GitHub app in their repositories
Browse files Browse the repository at this point in the history
Signed-off-by: Ludovic Ortega <[email protected]>
  • Loading branch information
M0NsTeRRR committed Nov 21, 2024
1 parent 84c6bd2 commit 568915a
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 28 deletions.
5 changes: 0 additions & 5 deletions github/resource_github_app_installation_repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,6 @@ func resourceGithubAppInstallationRepositoriesDelete(d *schema.ResourceData, met
}

func getAllAccessibleRepos(meta interface{}, idString string) (map[string]int64, int64, error) {
err := checkOrganization(meta)
if err != nil {
return nil, 0, err
}

installationID, err := strconv.ParseInt(idString, 10, 64)
if err != nil {
return nil, 0, unconvertibleIdErr(idString, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestAccGithubAppInstallationRepositories(t *testing.T) {
})

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

t.Run("with an organization account", func(t *testing.T) {
Expand Down
15 changes: 0 additions & 15 deletions github/resource_github_app_installation_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ func resourceGithubAppInstallationRepository() *schema.Resource {
}

func resourceGithubAppInstallationRepositoryCreate(d *schema.ResourceData, meta interface{}) error {
err := checkOrganization(meta)
if err != nil {
return err
}

installationIDString := d.Get("installation_id").(string)
installationID, err := strconv.ParseInt(installationIDString, 10, 64)
if err != nil {
Expand All @@ -71,11 +66,6 @@ func resourceGithubAppInstallationRepositoryCreate(d *schema.ResourceData, meta
}

func resourceGithubAppInstallationRepositoryRead(d *schema.ResourceData, meta interface{}) error {
err := checkOrganization(meta)
if err != nil {
return err
}

client := meta.(*Owner).v3client
installationIDString, repoName, err := parseTwoPartID(d.Id(), "installation_id", "repository")
if err != nil {
Expand Down Expand Up @@ -124,11 +114,6 @@ func resourceGithubAppInstallationRepositoryRead(d *schema.ResourceData, meta in
}

func resourceGithubAppInstallationRepositoryDelete(d *schema.ResourceData, meta interface{}) error {
err := checkOrganization(meta)
if err != nil {
return err
}

installationIDString := d.Get("installation_id").(string)
installationID, err := strconv.ParseInt(installationIDString, 10, 64)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_app_installation_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestAccGithubAppInstallationRepository(t *testing.T) {
})

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

t.Run("with an organization account", func(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions website/docs/r/app_installation_repositories.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ description: |-
~> **Note**: This resource is not compatible with the GitHub App Installation authentication method.

This resource manages relationships between app installations and repositories
in your GitHub organization.
in your GitHub organization or your user account.

Creating this resource installs a particular app on multiple repositories.

The app installation and the repositories must all belong to the same
organization on GitHub. Note: you can review your organization's installations
organization or user account on GitHub. Note: you can review your organization's installations
by the following the instructions at this
[link](https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/reviewing-your-organizations-installed-integrations).
[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).

## Example Usage

Expand Down
6 changes: 3 additions & 3 deletions website/docs/r/app_installation_repository.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ description: |-
~> **Note**: This resource is not compatible with the GitHub App Installation authentication method.

This resource manages relationships between app installations and repositories
in your GitHub organization.
in your GitHub organization or your user account.

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

The app installation and the repository must both belong to the same
organization on GitHub. Note: you can review your organization's installations
organization or user account on GitHub. Note: you can review your organization's installations
by the following the instructions at this
[link](https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/reviewing-your-organizations-installed-integrations).
[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).

## Example Usage

Expand Down

0 comments on commit 568915a

Please sign in to comment.