fix(github): support GitHub Enterprise for PR creation#1244
Merged
arnestrickmann merged 1 commit intogeneralaction:mainfrom Mar 3, 2026
Merged
fix(github): support GitHub Enterprise for PR creation#1244arnestrickmann merged 1 commit intogeneralaction:mainfrom
arnestrickmann merged 1 commit intogeneralaction:mainfrom
Conversation
|
@krzysztofcybulski is attempting to deploy a commit to the General Action Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Greptile SummaryThis PR fixes GitHub Enterprise (GHE) support for PR creation by removing the
Confidence Score: 3/5
|
| Filename | Overview |
|---|---|
| src/main/services/GitHubService.ts | hasGitHubRemote() replaced with a gh CLI network call, introducing a performance regression (doubles API calls per search keystroke) and semantic change (returns false when offline or gh is unauthenticated, hiding GitHub features for legitimate GitHub repos). |
| src/main/ipc/gitIpc.ts | Removed --repo flag and owner:branch head format from both local and remote SSH gh pr create paths; changes are correct for same-repo worktrees and GHE support. The repoNameWithOwner resolution code (including its fallback URL parser) is cleanly removed. |
Sequence Diagram
sequenceDiagram
participant UI as UI (Search Input)
participant GHS as GitHubService
participant GH as gh CLI / GitHub API
Note over UI,GH: Before this PR (local check only)
UI->>GHS: searchIssues(projectPath, term)
GHS->>GHS: git remote -v (local, instant)
GHS->>GH: gh issue list --search ... (1 network call)
GH-->>GHS: issues[]
GHS-->>UI: results
Note over UI,GH: After this PR (two network calls per keystroke)
UI->>GHS: searchIssues(projectPath, term)
GHS->>GH: gh repo view --json nameWithOwner (network call #1)
GH-->>GHS: nameWithOwner or error
GHS->>GH: gh issue list --search ... (network call #2)
GH-->>GHS: issues[]
GHS-->>UI: results
Note over UI,GH: PR creation - GHE now works
UI->>GHS: createPR(taskPath, ...)
GHS->>GH: gh pr create --title ... --base ... --head branch
GH-->>GHS: PR URL
GHS-->>UI: success
Last reviewed commit: 9aeeac0
Remove --repo flag from gh pr create and let gh auto-detect the correct host from the git remote. Previously the --repo owner/repo flag caused gh to default to github.com, breaking PR creation on GHE instances. Also replace the hardcoded github.com check in hasGitHubRemote() with gh repo view, which works for any authenticated GitHub instance. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9aeeac0 to
62853bb
Compare
Contributor
|
Thanks for the PR! GHE support is a real gap we've been missing. @krzysztofcybulski |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR creation was previously broken on GitHub Enterprise (GHE) instances because the codebase assumed all GitHub remotes were hosted on
github.com. Specifically:gh repo view --json nameWithOwnerfails on GHE hosts if they are not the default, causing the--repoand--head owner:branchflags to be malformed or missing.hasGitHubRemote()explicitly searched for thegithub.comstring in remote URLs, which caused GHE repositories to be incorrectly identified as non-GitHub.This PR removes these assumptions and allows the GitHub CLI (
gh) to handle host resolution natively based on the local git configuration.Changes
src/main/ipc/gitIpc.ts — PR creation (local and remote)
nameWithOwnerviagh repo viewto pass an explicit--repo owner/repoflag. This is unnecessary asgh pr createautomatically infers the repository from the working directory's git remote. The explicit flag caused failures on GHE when the host was notgithub.com.owner:branchto using the branch name directly. Theowner:prefix is only necessary for cross-fork PRs, which are not currently a use case for Emdash. This avoids a failure cascade when repository resolution fails.--repoflag.src/main/services/GitHubService.ts — Issue listing
github.comin the output ofgit remote -vbefore executing issue commands. On GHE repositories, this check always failed, silently disabling issue integration features.listIssues()andsearchIssues(). On non-GitHub repositories, theghCLI fails quickly; the code now catches these failures and returns an empty list as intended.Test Plan
pnpm run type-checkpasses.pnpm exec vitest runpasses (noting that 3 pre-existing failures inTaskLifecycleService.test.tsare unrelated to these changes).