From 2e1037a136f3ada672ce306cbc9f5b31c277e9fc Mon Sep 17 00:00:00 2001 From: Elior Erez Date: Sat, 21 Nov 2026 12:52:40 -0500 Subject: [PATCH] NO-ISSUE: let ci-duty manage the GitHub Apps of the org Assign GitHub's predefined App manager organization role to the ci-duty team, so it can register and manage the GitHub Apps the organization owns (the OSAC CI app) without being org owners. The role does not let them install an app or list it in the Marketplace: an organization owner does that. Signed-off-by: Elior Erez --- README.md | 4 ++++ organization.tf | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/README.md b/README.md index 9530b00..73d17e4 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,10 @@ Add them to the `ci-duty` team (`team-members/ci-duty.csv`). That team: checks, and on `osac` it may also bypass the required reviews (`pull_request_bypassers`). GitHub shows that checkbox only to someone who can bypass every rule on the branch. See `repositories.tf`. +- Holds GitHub's predefined **App manager** organization role, so its members can register + and manage the GitHub Apps the organization owns (the OSAC CI app, for example). It does not + let them install or uninstall an app, or list one in the Marketplace: an organization owner + does that. See `organization.tf`. - Has the `ci-maintainer` custom repository role on `osac` and `osac-test-infra`: write, plus management of the repository's Actions secrets, variables, environments, settings and runners, merge queue priority (jump the queue, solo merge), and bypass of branch diff --git a/organization.tf b/organization.tf index 9b41d50..df6236e 100644 --- a/organization.tf +++ b/organization.tf @@ -54,6 +54,25 @@ resource "github_organization_role_team" "cicd_admin_ci_duty" { team_slug = github_team.all["ci-duty"].slug } +# Assign GitHub's predefined "App manager" organization role to the ci-duty team, +# so it can register and manage the GitHub Apps owned by the organization (the OSAC +# CI app, for example) without being org owners. The role does not let them install +# or uninstall an app on the organization, or list an app in the Marketplace: an +# organization owner does that. Unlike the CI/CD admin role above, the API's name +# for this role is known: `gh api /orgs/osac-project/organization-roles` lists it +# as "app_manager" (source "Predefined"). +locals { + app_manager_role_id = one([ + for r in data.github_organization_roles.all.roles : r.role_id + if r.source == "Predefined" && r.name == "app_manager" + ]) +} + +resource "github_organization_role_team" "app_manager_ci_duty" { + role_id = local.app_manager_role_id + team_slug = github_team.all["ci-duty"].slug +} + # Custom repository role for CI duty on the CI repositories (osac and # osac-test-infra). The CI/CD admin role above covers only org-level Actions # settings, so without this, repository secrets and variables (BUF_TOKEN,