Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions baton_capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
{
"@type": "type.googleapis.com/c1.connector.v2.V1Identifier",
"id": "org"
},
{
"@type": "type.googleapis.com/c1.connector.v2.SkipEntitlements"
}
]
},
Expand All @@ -50,6 +53,9 @@
{
"@type": "type.googleapis.com/c1.connector.v2.V1Identifier",
"id": "org_role"
},
{
"@type": "type.googleapis.com/c1.connector.v2.SkipEntitlements"
}
]
},
Expand All @@ -67,6 +73,9 @@
{
"@type": "type.googleapis.com/c1.connector.v2.V1Identifier",
"id": "repository"
},
{
"@type": "type.googleapis.com/c1.connector.v2.SkipEntitlements"
}
]
},
Expand All @@ -87,6 +96,9 @@
{
"@type": "type.googleapis.com/c1.connector.v2.V1Identifier",
"id": "team"
},
{
"@type": "type.googleapis.com/c1.connector.v2.SkipEntitlements"
}
]
},
Expand Down
12 changes: 10 additions & 2 deletions config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@
"displayName": "Omit syncing archived repositories",
"description": "Whether to skip syncing archived repositories or not",
"boolField": {}
},
{
"name": "direct-collaborators-only",
"displayName": "Optimize sync for large organizations",
"description": "Reduces API calls by using grant expansion for team-based repo access and skipping per-team detail fetches. Recommended for large orgs.",
"boolField": {}
}
],
"displayName": "GitHub Enterprise",
Expand All @@ -192,7 +198,8 @@
"token",
"orgs",
"enterprises",
"omit-archived-repositories"
"omit-archived-repositories",
"direct-collaborators-only"
],
"default": true
},
Expand All @@ -207,7 +214,8 @@
"org",
"enterprises",
"sync-secrets",
"omit-archived-repositories"
"omit-archived-repositories",
"direct-collaborators-only"
]
}
]
Expand Down
5 changes: 5 additions & 0 deletions docs/connector.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ If you're using a personal access token to set up the connector:
1. **Optional.** If you want to sync roles for only some enterprises, add the names of the enterprises in the **Enterprises to sync enterprise roles for** field.

1. **Optional.** If you do not want to include archived repos in syncs, click to enable **Omit archived repositories**.

1. **Optional.** For large organizations, click to enable **Optimize sync for large organizations**. This reduces API calls by using grant expansion for team-based repo access and skipping per-team detail fetches.
</Step>
<Step>
If you're using a GitHub app to set up the connector:
Expand All @@ -254,6 +256,8 @@ If you're using a GitHub app to set up the connector:
1. **Optional.** If you want to sync roles for only some enterprises, add the names of the enterprises in the **Enterprises to sync enterprise roles for** field.

1. **Optional.** If you do not want to include archived repos in syncs, click to enable **Omit archived repositories**.

1. **Optional.** For large organizations, click to enable **Optimize sync for large organizations**. This reduces API calls by using grant expansion for team-based repo access and skipping per-team detail fetches.
</Step>
<Step>
Click **Save**.
Expand Down Expand Up @@ -346,6 +350,7 @@ baton-github-enterprise \
| :--- | :--- |
| `--enterprises` | Comma-separated list of enterprises to sync enterprise roles for. |
| `--omit-archived-repositories` | Exclude archived repositories from syncs. |
| `--direct-collaborators-only` | Optimize sync for large organizations by reducing API calls (uses grant expansion for team-based repo access and skips per-team detail fetches). |
| `--provisioning` | Enable provisioning and deprovisioning. |
</Step>
<Step>
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/conductorone/baton-github-enterprise
go 1.25.2

require (
github.com/conductorone/baton-github v0.2.15
github.com/conductorone/baton-github v0.3.3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Suggestion: baton-github v0.3.3 adds a direct-collaborators-only config option that optimizes sync for large orgs (skips per-team detail fetches, uses direct collaborator affiliation, adds org→repo expandable grants). The enterprise connector's pkg/connector/connector.go and pkg/config/config.go don't wire this field through, so enterprise users can't enable the optimization. Consider adding it in a follow-up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

github.com/conductorone/baton-sdk v0.9.16
github.com/ennyjfrick/ruleguard-logfatal v0.0.2
github.com/quasilyte/go-ruleguard/dsl v0.3.23
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/conductorone/baton-github v0.2.15 h1:8TXW9mNa9+wPB5n1ghTXg+4baUEFo3ARlBoPxvyqBoQ=
github.com/conductorone/baton-github v0.2.15/go.mod h1:qyVHJTc78i0iJmoIrCZkTUFENndRnm+3AVvzahX1Vzk=
github.com/conductorone/baton-github v0.3.3 h1:W5BR64l/aTpyvjUcBHt9+aJK1/JmwaFGpOHtau1aHJU=
github.com/conductorone/baton-github v0.3.3/go.mod h1:50KZVcuXgAF+WlkeKQ4yaWr0N46okhIc7d54sYXU7js=
github.com/conductorone/baton-sdk v0.9.16 h1:/f9S1umZc7utfDXuWuNLkweCzqToo93LMLvhoNW8ABw=
github.com/conductorone/baton-sdk v0.9.16/go.mod h1:treFEoFwbzu9hgPqpCRD+Sr+p71xkeH98Y4ofDGrjSg=
github.com/conductorone/dpop v0.2.6 h1:fakwai/Xm2b/fcDUwJN41WtcSI/2UhQOyRIVvnnrrNA=
Expand Down
1 change: 1 addition & 0 deletions pkg/config/conf.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ var (
field.WithDescription("Organization of your github app"),
field.WithRequired(true),
)
directCollaboratorsOnly = field.BoolField(
"direct-collaborators-only",
field.WithDisplayName("Optimize sync for large organizations"),
field.WithDescription(
"Reduces API calls by using grant expansion for team-based repo access "+
"and skipping per-team detail fetches. Recommended for large orgs.",
),
)
)

//go:generate go run ./gen
Expand All @@ -81,6 +89,7 @@ var Config = field.NewConfiguration(
EnterprisesField,
syncSecrets,
omitArchivedRepositories,
directCollaboratorsOnly,
},
field.WithConnectorDisplayName("GitHub Enterprise"),
field.WithHelpUrl("/docs/baton/github-enterprise"),
Expand All @@ -90,14 +99,14 @@ var Config = field.NewConfiguration(
Name: GithubPersonalAccessTokenGroup,
DisplayName: "Personal access token",
HelpText: "Use a personal access token for authentication.",
Fields: []field.SchemaField{instanceUrlField, accessTokenField, orgsField, EnterprisesField, omitArchivedRepositories},
Fields: []field.SchemaField{instanceUrlField, accessTokenField, orgsField, EnterprisesField, omitArchivedRepositories, directCollaboratorsOnly},
Default: true,
},
{
Name: GithubAppGroup,
DisplayName: "GitHub app",
HelpText: "Use a github app for authentication",
Fields: []field.SchemaField{instanceUrlField, appIDField, appPrivateKeyPath, orgField, EnterprisesField, syncSecrets, omitArchivedRepositories},
Fields: []field.SchemaField{instanceUrlField, appIDField, appPrivateKeyPath, orgField, EnterprisesField, syncSecrets, omitArchivedRepositories, directCollaboratorsOnly},
Default: false,
},
}),
Expand Down
1 change: 1 addition & 0 deletions pkg/connector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ func NewLambdaConnector(ctx context.Context, ghc *cfg.Githubenterprise, cliOpts
AppId: ghc.AppId,
AppPrivatekeyPath: ghc.AppPrivatekeyPath,
Org: ghc.Org,
DirectCollaboratorsOnly: ghc.DirectCollaboratorsOnly,
}, cliOpts)
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 17 additions & 2 deletions vendor/github.com/conductorone/baton-github/pkg/config/config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading