Skip to content

Support output json gh pr checks #6056

Description

@wzshiming

Describe the feature or problem you’d like to solve

Like this

Usage:  gh pr status [flags]

Flags:
  -q, --jq expression     Filter JSON output using a jq expression
      --json fields       Output JSON with the specified fields
  -t, --template string   Format JSON output using a Go template

Proposed solution

Additional context

Activity

  1. vilmibm commented on Aug 11, 2022

    @vilmibm
    Contributor

    I'm not opposed to this, but I would want to see a proposal of what the JSON payload would look like.

    Behind the scenes, gh pr checks is combining data from a few different endpoints. It doesn't cleanly map to a single query with a single JSON payload.

    The central question is if gh pr checks should try and output a single, consistent JSON schema combining the results of action workflow runs and checks or if it should do something like:

    {
      "checks": {},
      "runs": {}
    }

    with the corresponding payloads for checks and runs.

    I'm going to mark this as needs-design and leave it open, but will refrain from encouraging PRs until there is a design consensus.

    turned out to all be wrong based on out of date knowledge, see followup comment

  2. added
    needs-designAn engineering task needs design to proceed
    and removed on Aug 11, 2022
  3. vilmibm commented on Aug 17, 2022

    @vilmibm
    Contributor

    I've refreshed myself on the code for pr checks and remembered that it's now using the status check rollup that combines checks and runs into a single list ^_^()

    My previous comment can be ignored and I'm ok with a PR that gives the --json treatment to the StatusCheckRollup payload.

  4. added and removed
    needs-designAn engineering task needs design to proceed
    on Aug 17, 2022
  5. redhoyasa commented on Aug 17, 2022

    @redhoyasa

    I'm interested to work on this.

    As I observe that gh pr checks also does some aggregations, I think we should also put this in the JSON payload.

    My proposed payload:

    {
      "summary": {
        "failed": 0,
        "passed": 1,
        "pending": 1,
        "skipping": 1
      },
      "checkruns": [
        {
          "completedAt": "...",
          "conclusion": "...",
          "detailsUrl": "...",
          "name": "...",
          "startedAt": "...",
          "status": "...",
          "workflowName": "..."
        }
        // more checkruns here
      ]
    }

    wdyt?

  6. mislav commented on Oct 24, 2022

    @mislav
    Contributor
  7. darthwalsh commented on Jun 30, 2023

    @darthwalsh
    Contributor

    This would be useful!

    Right now if you try to parse the output in a script, e.g. grep for success: gh pr checks 123 | grep '✓'
    ...you find out the CLI output changes to instead print tab-separated pass and the nice emojis are gone.

  8. risset commented on Jul 18, 2023

    @risset

    Would it be practical to get check run outputs here too? I'm interested in being able to retrieve why a particular check is failing

  9. wildan3105 commented on Sep 20, 2023

    @wildan3105

    hi @redhoyasa, are you still actively 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 CLIgh-prrelating to the gh pr commandhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions