Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh variable get, gh variable delete, gh secret delete do not resolve Enterprise host based on repository #9274

@yukha-dw

Description

@yukha-dw

Describe the bug

Most of gh variable/secret command does not working on enterprise due to invalid hostname such as:

  • gh variable get
  • gh variable delete
  • gh secret delete

UPDATED: @andyfeller removed remove aliases from the above list being redundant to delete as well as gh secret get because this command does not exist

Context:

  • I use SSH to clone repository (doesn't matter as I have tried to git clone using HTTPS)
  • git version 2.25.1
  • gh version 2.51.0 (2024-06-13)
  • GitHub Enterprise Server 3.9.13

Steps to reproduce the behavior

  1. chdir to repository

  2. Check FOO_BAR is exist

$ gh variable list
NAME                   VALUE                                           UPDATED             
FOO_BAR                FOO                                             about 58 minutes ago
  1. Get FOO_BAR without --repo arg
$ gh variable get FOO_BAR
[git remote -v]
[git config --get-regexp ^remote\..*\.gh-resolved$]
* Request at 2024-07-01 12:36:05.457290778 +0700 WIB m=+0.061940590
* Request to https://api.github.com/repos/owner-name/repo-name/actions/variables/FOO_BAR
* Request took 752.878786ms
variable FOO_BAR was not found
  1. Get FOO_BAR with --repo arg (https://, http://, without protocol)
$ gh variable get FOO_BAR --repo https://enterprise-github.com/owner-name/repo-name
* Request at 2024-07-01 12:35:21.358327957 +0700 WIB m=+0.047103012
* Request to https://api.github.com/repos/owner-name/repo-name/actions/variables/FOO_BAR
* Request took 638.744861ms
variable FOO_BAR was not found
  1. Get FOO_BAR with REST API
$ gh api -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  --hostname enterprise-github.com
  /repos/owner-name/repo-name/actions/variables/FOO_BAR
* Request at 2024-07-01 12:39:02.137287999 +0700 WIB m=+0.047488350
* Request to https://enterprise-github.com/api/v3/repos/owner-name/repo-name/actions/variables/FOO_BAR
* Request took 747.641379ms
{
  "name": "FOO_BAR",
  "value": "FOO",
  "created_at": "2024-07-01T04:32:35Z",
  "updated_at": "2024-07-01T04:32:35Z"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-variablerelating to the gh variable commandp1Affects a large population and inhibits work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions