Skip to content

Allow --json on the run command #3477

Description

@Spazzy757

Describe the feature or problem you’d like to solve

Currently the CLI has the ability for the issues and pullrequests to output as json (#385), this is not included in the run command

e.g: gh run list --json

Proposed solution

Giving a structured output that does not need libraries like awk to pull out the valid data is helpful in many automation cases (i.e see the output of a run to use in an automation script). Adding --json will make this vastly easier

Additional Context

I looked through the current issues and did not find an issue that specifically for this, apologies if I missed one

Activity

  1. changed the title [-]Allow `--json` on the runcommand[/-] [+]Allow `--json` on the run command[/+] on Apr 21, 2021
  2. vilmibm commented on Apr 22, 2021

    @vilmibm
    Contributor

    We should definitely do this.

    @mislav do you want to continue to take point on this type of work or is there enough prior art given the recent release to mark this as help-wanted?

  3. added
    coreThis issue is not accepting PRs from outside contributors
    on May 18, 2021
  4. mislav commented on Jun 18, 2021

    @mislav
    Contributor

    I'm marking this help-wanted.

    Here's an example of how release view --json handles exporting data:

    if opts.Exporter != nil {
    return opts.Exporter.Write(opts.IO.Out, release, opts.IO.ColorEnabled())
    }

    Someone could add this to run list function and pass in the []shared.Run slice as data to be exported. The final bit would be defining a shared.Run.ExportData() so that a Run object can be converted into data that is to be serialized as JSON for output:

    func (rel *Release) ExportData(fields []string) *map[string]interface{} {

  5. added and removed
    coreThis issue is not accepting PRs from outside contributors
    on Jun 18, 2021
  6. cristiand391 commented on Jun 20, 2021

    @cristiand391
    Contributor

    I'm working on this.

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

    enhancementa request to improve CLIhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions