Skip to content

gh project view and gh project list with --web should work correctly when targeting hosts other than github.com #8779

Description

@williammartin

Describe the bug

➜  gh version
gh version 2.44.1 (2024-02-16)
https://github.com/cli/cli/releases/tag/v2.44.1

When targeting a host other than github.com host e.g. GHES, the --web functionality of project view and project list are broken because they always open the browser pointing at github.com.

This occurs because the buildURL function that creates the correct URL to browse to was never written to support hosts other than github.com:

// TODO: support non-github.com hostnames
func buildURL(config listConfig) (string, error) {
var url string
if config.opts.owner == "@me" || config.opts.owner == "" {
owner, err := config.client.ViewerLoginName()

Steps to reproduce the behavior

  1. Authenticate with a host other than github.com
  2. GH_HOST=<host> gh project list --web
  3. See that the browser opens pointing at github.com

The same behaviour occurs for project view.

Expected vs actual behavior

The URL is opened targeting the correct host.

Extra Notes

Note that project view is likely to be fixed incidentally as part of #8773 which will take a different approach to obtaining the correct URL.

Activity

  1. added
    bugSomething isn't working
    gh-projectrelating to the gh project command
    on Mar 1, 2024
  2. added
    priority-3Affects a small number of users or is largely cosmetic
    on Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-projectrelating to the gh project commandpriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions