Skip to content

Conversation

@atilsensalduz
Copy link

@atilsensalduz atilsensalduz commented Feb 23, 2025

This PR introduces a new data source, github_app_installations, to enable listing all installed GitHub Apps within an organization. This addition enhances integration with existing resources such as github_app_installation_repository, providing better automation and management capabilities for GitHub App permissions.

What's New?
New Data Source: github_app_installations
Allows fetching all installed GitHub Apps in an organization:

data "github_organization_app_installations" "all_apps" {}

Example Use Case:
This data source can be integrated with the github_app_installation_repository resource to manage app permissions on specific repositories:

# Local value to find the correct app installation by slug
locals {
  # Find the index of the desired app by its slug
  app_index = index(
    data.github_organization_app_installations.all_apps.installations[*].slug,
    "desired-app-name"  # Replace with your actual app slug
  )
  
  # Get the app_id using the found index
  app_installation_id = data.github_organization_app_installations.all_apps.installations[local.app_index].id
}

# Link the repository to the app installation
resource "github_app_installation_repository" "some_app_repo" {
  installation_id = local.app_installation_id
  repository     = github_repository.some_repo.name
}

API Reference: https://docs.github.com/en/rest/orgs/orgs?apiVersion=2022-11-28#list-app-installations-for-an-organization

Related Issue: #2570

…tion

This commit introduces a new data source, 'github_organization_app_installations', to enable listing all installed GitHub Apps within an organization.

References:
- API Documentation: https://docs.github.com/en/rest/orgs/orgs?apiVersion=2022-11-28#list-app-installations-for-an-organization
- Related Issue: integrations#2570

Signed-off-by: atilsensalduz <[email protected]>
@atilsensalduz atilsensalduz changed the title feat: Add data sources for listing GitHub App installations in an organization feat: add data sources for listing GitHub App installations in an organization Feb 23, 2025
…tion

This commit introduces a new data source, 'github_organization_app_installations', to enable listing all installed GitHub Apps within an organization.

References:
- API Documentation: https://docs.github.com/en/rest/orgs/orgs?apiVersion=2022-11-28#list-app-installations-for-an-organization
- Related Issue: integrations#2570

Signed-off-by: atilsensalduz <[email protected]>
@nickfloyd nickfloyd moved this from 🆕 Triage to 👀 In review in 🧰 Octokit Active Feb 27, 2025
@github-actions
Copy link

github-actions bot commented Dec 6, 2025

👋 Hey Friends, this pull request has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

@github-actions github-actions bot added the Status: Stale Used by stalebot to clean house label Dec 6, 2025
Copy link
Contributor

@deiga deiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey 👋

Thank you for your contribution!

I've requested a few changes to make this fit into the provider even better :)

Comment on lines +11 to +37
return &schema.Resource{
Read: dataSourceGithubOrganizationAppInstallationsRead,

Schema: map[string]*schema.Schema{
"installations": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeInt,
Computed: true,
},
"slug": {
Type: schema.TypeString,
Computed: true,
},
"app_id": {
Type: schema.TypeInt,
Computed: true,
},
},
},
},
},
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Could you please add Description fields to the Schema and all fields?


func dataSourceGithubOrganizationAppInstallations() *schema.Resource {
return &schema.Resource{
Read: dataSourceGithubOrganizationAppInstallationsRead,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Could you refactor this to use ReadContext?

import (
"context"

"github.com/google/go-github/v66/github"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I doubt we'll be able to land this before #2602

Maybe you could even rebase on top of that branch?

Suggested change
"github.com/google/go-github/v66/github"
"github.com/google/go-github/v77/github"

"app_id": {
Type: schema.TypeInt,
Computed: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Could you add the following fields to this:

  • repository_selection
  • permissions
  • events
  • html_url
  • client_id
  • target_id
  • target_type
  • suspended

@github-project-automation github-project-automation bot moved this from 👀 In review to 🏗 In progress in 🧰 Octokit Active Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Stale Used by stalebot to clean house

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants