Skip to content

Not working with <company>.ghe.com #457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gustavkj opened this issue Mar 20, 2025 · 1 comment · Fixed by #458
Closed

Not working with <company>.ghe.com #457

gustavkj opened this issue Mar 20, 2025 · 1 comment · Fixed by #458
Labels
bug Something isn't working

Comments

@gustavkj
Copy link
Contributor

gustavkj commented Mar 20, 2025

Describe the bug
I tried to configure the extension to work with my company's new Github instance, which is running on a subdomain of ghe.com.

I wonder if line 79 is correct here, I would expect the value from github-enterprise.uri to start with https:// and as such api. is prepended to the protocol 🤔 :

export function getGitHubApiUri(): string {
if (!useEnterprise()) return DEFAULT_GITHUB_API;
const base = getConfiguration().get<string>("github-enterprise.uri", DEFAULT_GITHUB_API).replace(/\/$/, "");
if (base === DEFAULT_GITHUB_API) {
return base;
}
if (base.endsWith(".ghe.com")) {
return `api.${base}`;
} else {
return `${base}/api/v3`;
}
}

To Reproduce
Steps to reproduce the behavior:

  1. I updated the settings.json:
    {
      "github-actions.use-enterprise": true,
      "github-enterprise.uri": "https://<company>.ghe.com"
    }
  2. Signed into the Github Enterprise instance using the extension
  3. All action references appear broken in the editor. In the output, I see:
    Cannot fetch github context
    Error: Cannot fetch github context
        at Et (/home/<username>/.vscode-server/extensions/github.vscode-github-actions-0.27.1/dist/extension-node.js:2:1449407)
        at processTicksAndRejections (node:internal/process/task_queues:95:5)
        at /home/<username>/.vscode-server/extensions/github.vscode-github-actions-0.27.1/dist/extension-node.js:2:1630467
        at kw.h (file:///home/<username>/.vscode-server/bin/ddc367ed5c8936efe395cffeec279b04ffd7db78/out/vs/workbench/api/node/extensionHostProcess.js:112:41551)
        at /home/<username>/.vscode-server/extensions/github.vscode-github-actions-0.27.1/dist/extension-node.js:2:1629251
    

Expected behavior
That it would work with the Github Enterprise instance.

Screenshots
If applicable, add screenshots to help explain your problem.

Extension Version
v0.27.1

Additional context
Add any other context about the problem here.

@gustavkj
Copy link
Contributor Author

I've cloned the repo and started debugging the code. The issue with the base variable being incorrectly changed holds true, but there are more issues. E.g. line 81 in repository.ts causes issues since .host then does not match the content of the pushUrl (i.e. the api subdomain is not part of the host used for the remote, e.g. <company>@<company>.ghe.com:<org>/<repo>.git):

(useEnterprise() && remote[0].pushUrl?.indexOf(new URL(getGitHubApiUri()).host) !== -1))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

1 participant