Add `--json` support to `variable get` command · Issue #9118 · cli/cli · GitHub
Skip to content

Add --json support to variable get command #9118

Description

@williammartin

Description

With the addition of the variable get command in #9103, users can now get the value of individual variables. However, there is more information returned from these endpoints that might be valuable to expose e.g https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#get-an-organization-variable

{
  "name": "USERNAME",
  "value": "octocat",
  "created_at": "2019-08-10T14:59:22Z",
  "updated_at": "2020-01-10T14:59:22Z",
  "visibility": "selected",
  "selected_repositories_url": "https://api.github.com/orgs/octo-org/actions/variables/USERNAME/repositories"
}

The variable list command already supports --json, --jq and --template so we should ensure variable get has parity to maximise scripting potential.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-variablerelating to the gh variable commandhelp wantedContributions welcome

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions