diff --git a/backend/src/ee/routes/v1/github-org-sync-router.ts b/backend/src/ee/routes/v1/github-org-sync-router.ts index 52ec772e0..0d7279928 100644 --- a/backend/src/ee/routes/v1/github-org-sync-router.ts +++ b/backend/src/ee/routes/v1/github-org-sync-router.ts @@ -137,7 +137,6 @@ export const registerGithubOrgSyncRouter = async (server: FastifyZodProvider) => schema: { response: { 200: z.object({ - syncedUsersCount: z.number(), totalUsers: z.number(), errors: z.array(z.string()), createdTeams: z.array(z.string()), @@ -153,7 +152,6 @@ export const registerGithubOrgSyncRouter = async (server: FastifyZodProvider) => }); return { - syncedUsersCount: result.syncedUsersCount, totalUsers: result.totalUsers, errors: result.errors, createdTeams: result.createdTeams, diff --git a/backend/src/ee/services/github-org-sync/github-org-sync-service.ts b/backend/src/ee/services/github-org-sync/github-org-sync-service.ts index 211d86409..7c4ad15eb 100644 --- a/backend/src/ee/services/github-org-sync/github-org-sync-service.ts +++ b/backend/src/ee/services/github-org-sync/github-org-sync-service.ts @@ -553,7 +553,6 @@ export const githubOrgSyncServiceFactory = ({ ) as OrgMembershipWithUser[]; const startTime = Date.now(); - let syncedUsersCount = 0; const syncErrors: string[] = []; const octokit = new OctokitWithPlugin({ @@ -683,8 +682,6 @@ export const githubOrgSyncServiceFactory = ({ const updatedTeams = new Set(); const totalRemovedMemberships = 0; - syncedUsersCount = allGithubUsernamesInTeams.size; - await groupDAL.transaction(async (tx) => { if (teamsToCreate.length > 0) { const newGroups = await groupDAL.insertMany( @@ -810,7 +807,6 @@ export const githubOrgSyncServiceFactory = ({ ); return { - syncedUsersCount, totalUsers: activeMembers.length, errors: syncErrors, createdTeams: Array.from(createdTeams), diff --git a/backend/src/ee/services/github-org-sync/github-org-sync-types.ts b/backend/src/ee/services/github-org-sync/github-org-sync-types.ts index 5a4e5bdff..909414c2f 100644 --- a/backend/src/ee/services/github-org-sync/github-org-sync-types.ts +++ b/backend/src/ee/services/github-org-sync/github-org-sync-types.ts @@ -27,7 +27,6 @@ export interface TSyncAllTeamsDTO { } export interface TSyncResult { - syncedUsersCount: number; totalUsers: number; errors: string[]; createdTeams: string[]; diff --git a/docs/documentation/platform/github-org-sync.mdx b/docs/documentation/platform/github-org-sync.mdx index aa7ee3550..71dd9dbf6 100644 --- a/docs/documentation/platform/github-org-sync.mdx +++ b/docs/documentation/platform/github-org-sync.mdx @@ -49,17 +49,59 @@ When a user logs in via the GitHub OAuth flow and selects the configured organiz You can manually synchronize GitHub teams for all organization members who have previously logged in with GitHub. This bulk sync operation updates team memberships without requiring users to log in again. -To trigger a manual sync, click the **Manually sync GitHub teams for all organization members** button: + + + To perform manual syncs, you'll need to create a GitHub Personal Access Token with the appropriate permissions. GitHub offers two types of tokens: -![Manual sync](../../images/platform/external-syncs/github-org-sync-manual-sync.png) + + + 1. Go to [GitHub Settings → Personal Access Tokens → Tokens (classic)](https://github.com/settings/tokens) + 2. Click **Generate new token** → **Generate new token (classic)** + 3. Give your token a descriptive name (e.g., "Infisical GitHub Sync") + 4. Set an appropriate expiration date + 5. Select the **read:org** scope - Required to read organization team information + 6. Click **Generate token** + 7. Copy the token immediately (you won't be able to see it again) -If you don't have a GitHub token configured or your token has expired, a modal will appear prompting you to provide one: + ![Classic Token Creation](../../images/platform/external-syncs/github-classic-token.png) + + + 1. Go to [GitHub Settings → Personal Access Tokens → Fine-grained tokens](https://github.com/settings/personal-access-tokens/new) + 2. Click **Generate new token** + 3. Give your token a descriptive name (e.g., "Infisical GitHub Sync") + 4. Set an appropriate expiration date + 5. Select your organization under **Resource owner** + 6. Under **Organization permissions**, set **Members** to **Read** + 7. Click **Generate token** + 8. Copy the token immediately (you won't be able to see it again) -![token](../../images/platform/external-syncs/github-org-sync-manual-sync-token.png) + ![Fine-grained Token Creation](../../images/platform/external-syncs/github-fine-grained-token.png) + + + + + + 1. Navigate to the **Single Sign-On (SSO)** page and select the **Provisioning** tab. + 2. Click the **Configure** button next to your GitHub Organization configuration. + 3. In the configuration modal, you'll find an optional **GitHub Access Token** field. + 4. Paste the token you generated in the previous step. + 5. Click **Update** to save the configuration. - - The token must be granted **read:org** and **read:user** permissions to successfully sync groups. This configuration is only required once - if you already have a valid token configured, the sync will proceed automatically. - + ![Token Configuration Modal](../../images/platform/external-syncs/github-token-config-modal.png) + + + + Once you have configured the GitHub access token: + + 1. Navigate to the **Single Sign-On (SSO)** page and select the **Provisioning** tab. + 2. You'll see a **Sync Now** section with a button to trigger the manual sync. + 3. Click **Sync Now** to synchronize GitHub teams for all organization members. + + ![Manual Sync Button](../../images/platform/external-syncs/github-manual-sync-button.png) + + The sync operation will process all organization members who have previously logged in with GitHub and update their team memberships accordingly. + + ## Troubleshooting diff --git a/docs/images/platform/external-syncs/github-classic-token.png b/docs/images/platform/external-syncs/github-classic-token.png new file mode 100644 index 000000000..f59c4f362 Binary files /dev/null and b/docs/images/platform/external-syncs/github-classic-token.png differ diff --git a/docs/images/platform/external-syncs/github-fine-grained-token.png b/docs/images/platform/external-syncs/github-fine-grained-token.png new file mode 100644 index 000000000..4924fedd0 Binary files /dev/null and b/docs/images/platform/external-syncs/github-fine-grained-token.png differ diff --git a/docs/images/platform/external-syncs/github-manual-sync-button.png b/docs/images/platform/external-syncs/github-manual-sync-button.png new file mode 100644 index 000000000..291b9f033 Binary files /dev/null and b/docs/images/platform/external-syncs/github-manual-sync-button.png differ diff --git a/docs/images/platform/external-syncs/github-token-config-modal.png b/docs/images/platform/external-syncs/github-token-config-modal.png new file mode 100644 index 000000000..106738d3c Binary files /dev/null and b/docs/images/platform/external-syncs/github-token-config-modal.png differ diff --git a/frontend/src/hooks/api/githubOrgSyncConfig/mutations.tsx b/frontend/src/hooks/api/githubOrgSyncConfig/mutations.tsx index 9e240abde..3c78550ed 100644 --- a/frontend/src/hooks/api/githubOrgSyncConfig/mutations.tsx +++ b/frontend/src/hooks/api/githubOrgSyncConfig/mutations.tsx @@ -44,7 +44,6 @@ export const useDeleteGithubSyncOrgConfig = () => { export const useSyncAllGithubTeams = () => { return useMutation({ mutationFn: async (): Promise<{ - syncedUsersCount: number; totalUsers: number; errors: string[]; createdTeams: string[]; diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgProvisioningTab/GithubOrgSyncConfigModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgProvisioningTab/GithubOrgSyncConfigModal.tsx index 0710afa8a..4f852e7b5 100644 --- a/frontend/src/pages/organization/SettingsPage/components/OrgProvisioningTab/GithubOrgSyncConfigModal.tsx +++ b/frontend/src/pages/organization/SettingsPage/components/OrgProvisioningTab/GithubOrgSyncConfigModal.tsx @@ -51,7 +51,7 @@ export const GithubOrgSyncConfigModal = ({ formState: { isSubmitting } } = useForm({ resolver: zodResolver(schema), - values: data ? { githubOrgName: data.githubOrgName } : undefined + values: data ? { githubOrgName: data.githubOrgName, githubOrgAccessToken: "" } : undefined }); const onFormSubmit = async ({ githubOrgName, githubOrgAccessToken }: FormData) => { @@ -123,21 +123,21 @@ export const GithubOrgSyncConfigModal = ({ )} /> - {/* ( - + )} - /> */} + />
- -
- - - - ); };