Skip to content

Ghp/GitHub auth api foundation#292

Open
gambtho wants to merge 3 commits intoAzure:mainfrom
gambtho:ghp/github-auth-api-foundation
Open

Ghp/GitHub auth api foundation#292
gambtho wants to merge 3 commits intoAzure:mainfrom
gambtho:ghp/github-auth-api-foundation

Conversation

@gambtho
Copy link
Collaborator

@gambtho gambtho commented Feb 24, 2026

Summary

Add the foundational GitHub integration layer needed by the pipeline feature:

  • GitHub OAuth: Browser-based OAuth flow via Electron's desktopApi, with encrypted token persistence (safeStorage) and refresh token support
  • GitHub API wrapper: Octokit-based client for repo listing, workflow dispatch, file operations, PR/issue management, and status checks
  • Shared utilities: CopyButton component, useAzureContext hook, ProjectDefinition type, getRelativeTime helper, openExternalUrl for Electron-aware links
  • Pipeline API extensions: getIssue, dispatchWorkflow with inputs, file path constants, typed status checks

Changes

GitHub Auth (utils/github/)

  • github-auth.ts — Browser OAuth flow via desktopApi.startGitHubOAuth, callback listener, and token refresh through Electron main process
  • secure-storage.ts — Electron safeStorage wrapper with localStorage fallback for dev mode
  • github-auth.test.ts — Tests for OAuth start, callback, refresh, token expiry, and storage

GitHub API (utils/github/)

  • github-api.ts — Octokit wrapper: listRepos, getRepoDetails, createBranch, commitFiles, createPullRequest, getPullRequest, getStatusChecks, dispatchWorkflow, getIssue, checkRepoReadiness, getCurrentUser
  • github-api.test.ts — Comprehensive tests for all API functions

Shared Utilities

  • types/github.tsGitHubRepo, RepoReadiness, workflow types
  • types/project.tsProjectDefinition for pipeline component props
  • hooks/useAzureContext.ts — Resolves subscription, resource group, tenant from cluster info
  • components/shared/CopyButton.tsx — Clipboard copy with visual feedback
  • utils/shared/formatTime.tsgetRelativeTime helper
  • utils/shared/openExternalUrl.ts — Electron-aware external URL opener

Pipeline Constants

  • components/GitHubPipeline/constants.ts — Workflow and agent config file paths

Test plan

  • npm run tsc passes
  • npm run lint passes (pre-commit hooks)
  • npm test — github-auth and github-api test suites pass
  • Manual: verify OAuth flow works in Electron app

Copilot AI review requested due to automatic review settings February 24, 2026 04:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a foundational GitHub integration layer (OAuth + API wrapper) and shared utilities to support the upcoming pipeline feature.

Changes:

  • Introduces Electron-driven GitHub OAuth with encrypted token persistence + refresh support.
  • Adds an Octokit-based GitHub API wrapper for repo/workflow/PR/issue/status-check operations.
  • Adds shared UI/util helpers (CopyButton, relative time formatting, external URL opener) and shared types/constants.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
plugins/aks-desktop/src/utils/shared/openExternalUrl.ts Adds an Electron-aware external URL opener with protocol allowlist.
plugins/aks-desktop/src/utils/shared/formatTime.ts Adds getRelativeTime helper for UI-friendly timestamps.
plugins/aks-desktop/src/utils/github/secure-storage.ts Adds a thin wrapper around Electron safeStorage IPC methods.
plugins/aks-desktop/src/utils/github/github-auth.ts Implements GitHub OAuth start/callback/refresh and token persistence helpers.
plugins/aks-desktop/src/utils/github/github-auth.test.ts Adds tests for GitHub OAuth/token persistence utilities.
plugins/aks-desktop/src/utils/github/github-api.ts Adds Octokit wrapper functions for repo readiness, workflows, PRs/issues, checks, etc.
plugins/aks-desktop/src/utils/github/github-api.test.ts Adds tests for most GitHub API wrapper functions.
plugins/aks-desktop/src/types/project.ts Adds shared ProjectDefinition type.
plugins/aks-desktop/src/types/github.ts Adds shared GitHub-related types used across utils/components.
plugins/aks-desktop/src/hooks/useAzureContext.ts Adds hook to resolve subscription/resource group/tenant from cluster info.
plugins/aks-desktop/src/components/shared/CopyButton.tsx Adds reusable clipboard copy button with feedback tooltip.
plugins/aks-desktop/src/components/GitHubPipeline/constants.ts Adds workflow/config path constants and Copilot bot user set.
headlamp Updates submodule pointer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gambtho gambtho force-pushed the ghp/github-auth-api-foundation branch 2 times, most recently from 91df6e9 to 86daedc Compare February 24, 2026 05:00
Copilot AI review requested due to automatic review settings February 24, 2026 05:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gambtho gambtho force-pushed the ghp/github-auth-api-foundation branch from 86daedc to ad8d1f0 Compare February 24, 2026 08:15
@illume illume requested a review from Copilot February 25, 2026 12:39
Copy link
Collaborator

@illume illume left a comment

Choose a reason for hiding this comment

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

Please add the related issue(s) to the PR description?
Please check the git commit messages follow the guidelines?

I wonder if it's worth merging the other PR into this one? So that it's easier for folks to manually test?

@illume illume marked this pull request as draft February 25, 2026 12:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gambtho gambtho force-pushed the ghp/github-auth-api-foundation branch from ad8d1f0 to 7938538 Compare February 25, 2026 22:41
@gambtho gambtho marked this pull request as ready for review February 25, 2026 22:42
Copilot AI review requested due to automatic review settings February 25, 2026 22:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gambtho gambtho force-pushed the ghp/github-auth-api-foundation branch from 7938538 to 09420a9 Compare February 26, 2026 02:12
Copy link
Collaborator

@illume illume left a comment

Choose a reason for hiding this comment

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

Thanks for the changes.

Looks like the git message subject lines need updating.
Unfortunately, there's a git conflict now.

@illume illume marked this pull request as draft February 26, 2026 10:08
@gambtho gambtho force-pushed the ghp/github-auth-api-foundation branch 2 times, most recently from 7ae9aac to 1aeefed Compare February 26, 2026 15:22
@gambtho gambtho marked this pull request as ready for review February 26, 2026 15:22
Copilot AI review requested due to automatic review settings February 26, 2026 15:22
@gambtho
Copy link
Collaborator Author

gambtho commented Feb 26, 2026

fixed merge conflict, and updated headlamp submodule commit

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gambtho gambtho force-pushed the ghp/github-auth-api-foundation branch from 1aeefed to 329246b Compare February 26, 2026 16:19
@illume
Copy link
Collaborator

illume commented Feb 27, 2026

This one also needs the related issue in the PR description.

@illume illume added p-none No priority was assigned enhancement New feature or request labels Feb 27, 2026
Add GitHub OAuth authentication using Electron's native browser OAuth
flow via desktopApi (startBrowserOAuth + onOAuthCallback). Includes
token refresh, expiry checking, and encrypted token persistence via
Electron safeStorage with localStorage fallback for dev mode.
Add foundational types and utilities needed across the pipeline feature:

- ProjectDefinition type for project props used by pipeline components
- useAzureContext hook to resolve subscription, resource group, and tenant
  from cluster info
- getRelativeTime helper for human-readable timestamps
- openExternalUrl for Electron-aware external link handling
- CopyButton component for clipboard copy with visual feedback
Copilot AI review requested due to automatic review settings February 27, 2026 17:36
@gambtho gambtho force-pushed the ghp/github-auth-api-foundation branch from 329246b to 449c89b Compare February 27, 2026 17:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Add Octokit-based GitHub API wrapper for repository listing, workflow
dispatch, and file operations. Includes pipeline-specific operations:
issue tracking, linked PR discovery, and status checks.

Define GitHub repo, workflow, and run types. Extract workflow and agent
config file path constants. Scope app install URL to selected repos.
@gambtho gambtho force-pushed the ghp/github-auth-api-foundation branch from 449c89b to 40dbbea Compare February 27, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request p-none No priority was assigned

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants