[PR #13860] feat(github): add GitHub Enterprise Server support to GitHub Action #14848

Open
opened 2026-02-16 18:19:36 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13860

State: open
Merged: No


What does this PR do?

Fixes #12830

The GitHub Action hardcodes github.com URLs everywhere, so it can't run on GHES. This PR reads GITHUB_SERVER_URL and GITHUB_API_URL env vars (set automatically by GHES runners) and uses them to derive all host-specific values — Octokit/GraphQL baseUrl, git credential config keys, noreply emails, fork remote URLs, image attachment regexes, and the token revocation endpoint. Defaults to github.com when the env vars aren't set, so nothing changes for existing users.

Also adds a parseGitRemote function (host-agnostic version of parseGitHubRemote) so the install command detects GHES remotes and generates a workflow with use_github_token: true and write permissions pre-configured.

How did you verify your code works?

  • Both files transpile cleanly with bun build --no-bundle
  • All 38 existing + new tests pass (bun test test/cli/github-remote.test.ts and github-action.test.ts)
  • New tests cover parseGitRemote with GHES URLs, SSH, HTTPS, various hosts
  • Verified no remaining hardcoded github.com references that should be parameterized (only defaults, comments, and the opencode app URL which correctly stays on github.com)
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13860 **State:** open **Merged:** No --- ### What does this PR do? Fixes #12830 The GitHub Action hardcodes `github.com` URLs everywhere, so it can't run on GHES. This PR reads `GITHUB_SERVER_URL` and `GITHUB_API_URL` env vars (set automatically by GHES runners) and uses them to derive all host-specific values — Octokit/GraphQL `baseUrl`, git credential config keys, noreply emails, fork remote URLs, image attachment regexes, and the token revocation endpoint. Defaults to `github.com` when the env vars aren't set, so nothing changes for existing users. Also adds a `parseGitRemote` function (host-agnostic version of `parseGitHubRemote`) so the `install` command detects GHES remotes and generates a workflow with `use_github_token: true` and write permissions pre-configured. ### How did you verify your code works? - Both files transpile cleanly with `bun build --no-bundle` - All 38 existing + new tests pass (`bun test test/cli/github-remote.test.ts` and `github-action.test.ts`) - New tests cover `parseGitRemote` with GHES URLs, SSH, HTTPS, various hosts - Verified no remaining hardcoded `github.com` references that should be parameterized (only defaults, comments, and the opencode app URL which correctly stays on github.com)
yindo added the pull-request label 2026-02-16 18:19:36 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14848