Skip to content

Proposal: add a --compact flag to gh run watch #4535

Description

@ncw

Describe the feature or problem you’d like to solve

When using gh watch on large projects with more than a few jobs and steps the list of jobs goes off the top of the screen.

Proposed solution

I'd like to propose a --compact flag which only shows the current step of each job, rather than all the past and future steps.

Additional context

Currently the output looks like this when I do an rclone build. This is 200 lines long and nowhere near fits on the largest terminal.

Refreshing run status every 3 seconds. Press Ctrl+C to quit.

- test build #3111 · 1346339921
Triggered via push about 7 minutes ago

JOBS
- android-all (ID 3907194786)
  ✓ Set up job
  ✓ Checkout
  ✓ Set up Go 1.16
  ✓ Force NDK version
  ✓ Go module cache
  ✓ Set global environment variables
  ✓ build native rclone
  ✓ install gomobile
  ✓ arm-v7a gomobile build
  ✓ arm-v7a Set environment variables
  ✓ arm-v7a build
  ✓ arm64-v8a Set environment variables
  ✓ arm64-v8a build
  ✓ x86 Set environment variables
  ✓ x86 build
  ✓ x64 Set environment variables
  ✓ x64 build
  - Upload artifacts
  - Post Go module cache
  - Post Checkout
X lint in 1m29s (ID 3907194927)
  ✓ Set up job
  ✓ Checkout
  X Code quality test
  ✓ Post Code quality test
  ✓ Post Checkout
  ✓ Complete job
- linux (ID 3907195090)
  ✓ Set up job
  ✓ Checkout
  ✓ Install Go
  ✓ Set environment variables
  ✓ Install Libraries on Linux
  ✓ Install Libraries on macOS
  ✓ Install Libraries on Windows
  ✓ Print Go version and environment
  ✓ Go module cache
  ✓ Build rclone
  ✓ Run tests
  - Race test
  - Run librclone tests
  - Compile all architectures test
  - Deploy built binaries
  - Post Go module cache
  - Post Checkout
- mac_amd64 (ID 3907195150)
  ✓ Set up job
  ✓ Checkout
  ✓ Install Go
  ✓ Set environment variables
  ✓ Install Libraries on Linux
  ✓ Install Libraries on macOS
  ✓ Install Libraries on Windows
  ✓ Print Go version and environment
  ✓ Go module cache
  ✓ Build rclone
  ✓ Run tests
  - Race test
  - Run librclone tests
  - Compile all architectures test
  - Deploy built binaries
  - Post Go module cache
  - Post Checkout
✓ mac_arm64 in 3m56s (ID 3907195227)
  ✓ Set up job
  ✓ Checkout
  ✓ Install Go
  ✓ Set environment variables
  ✓ Install Libraries on Linux
  ✓ Install Libraries on macOS
  ✓ Install Libraries on Windows
  ✓ Print Go version and environment
  ✓ Go module cache
  ✓ Build rclone
  ✓ Run tests
  ✓ Race test
  ✓ Run librclone tests
  ✓ Compile all architectures test
  ✓ Deploy built binaries
  ✓ Post Go module cache
  ✓ Post Checkout
  ✓ Complete job
- windows_amd64 (ID 3907195293)
  ✓ Set up job
  ✓ Checkout
  ✓ Install Go
  ✓ Set environment variables
  ✓ Install Libraries on Linux
  ✓ Install Libraries on macOS
  ✓ Install Libraries on Windows
  ✓ Print Go version and environment
  ✓ Go module cache
  ✓ Build rclone
  ✓ Run tests
  - Race test
  - Run librclone tests
  - Compile all architectures test
  - Deploy built binaries
  - Post Go module cache
  - Post Checkout
- windows_386 (ID 3907195369)
  ✓ Set up job
  ✓ Checkout
  ✓ Install Go
  ✓ Set environment variables
  ✓ Install Libraries on Linux
  ✓ Install Libraries on macOS
  ✓ Install Libraries on Windows
  ✓ Print Go version and environment
  ✓ Go module cache
  ✓ Build rclone
  - Run tests
  - Race test
  - Run librclone tests
  - Compile all architectures test
  - Deploy built binaries
  - Post Go module cache
  - Post Checkout
- other_os (ID 3907195431)
  ✓ Set up job
  ✓ Checkout
  ✓ Install Go
  ✓ Set environment variables
  ✓ Install Libraries on Linux
  ✓ Install Libraries on macOS
  ✓ Install Libraries on Windows
  ✓ Print Go version and environment
  ✓ Go module cache
  ✓ Build rclone
  ✓ Run tests
  ✓ Race test
  ✓ Run librclone tests
  - Compile all architectures test
  - Deploy built binaries
  - Post Go module cache
  - Post Checkout
- go1.14 (ID 3907195496)
  ✓ Set up job
  ✓ Checkout
  ✓ Install Go
  ✓ Set environment variables
  ✓ Install Libraries on Linux
  ✓ Install Libraries on macOS
  ✓ Install Libraries on Windows
  ✓ Print Go version and environment
  ✓ Go module cache
  ✓ Build rclone
  ✓ Run tests
  - Race test
  - Run librclone tests
  - Compile all architectures test
  - Deploy built binaries
  - Post Go module cache
  - Post Checkout
- go1.15 (ID 3907195576)
  ✓ Set up job
  ✓ Checkout
  ✓ Install Go
  ✓ Set environment variables
  ✓ Install Libraries on Linux
  ✓ Install Libraries on macOS
  ✓ Install Libraries on Windows
  ✓ Print Go version and environment
  ✓ Go module cache
  ✓ Build rclone
  ✓ Run tests
  - Race test
  - Run librclone tests
  - Compile all architectures test
  - Deploy built binaries
  - Post Go module cache
  - Post Checkout
- go1.16 (ID 3907195648)
  ✓ Set up job
  ✓ Checkout
  ✓ Install Go
  ✓ Set environment variables
  ✓ Install Libraries on Linux
  ✓ Install Libraries on macOS
  ✓ Install Libraries on Windows
  ✓ Print Go version and environment
  ✓ Go module cache
  ✓ Build rclone
  ✓ Run tests
  - Race test
  - Run librclone tests
  - Compile all architectures test
  - Deploy built binaries
  - Post Go module cache
  - Post Checkout

ANNOTATIONS
X golangci-lint exit with code 4

I'd propose that it be shortened to this with the --compact flag, where what is showing is the current step only, or if it has finished, the first failing step, otherwise the last step.

This is only 31 lines long, conveys all the important detail and would fit on my terminal just fine!

Refreshing run status every 3 seconds. Press Ctrl+C to quit.

- test build #3111 · 1346339921
Triggered via push about 7 minutes ago

JOBS
- android-all (ID 3907194786)
  - Upload artifacts
X lint in 1m29s (ID 3907194927)
  X Code quality test
- linux (ID 3907195090)
  - Race test
- mac_amd64 (ID 3907195150)
  - Race test
✓ mac_arm64 in 3m56s (ID 3907195227)
  ✓ Complete job
- windows_amd64 (ID 3907195293)
  - Race test
- windows_386 (ID 3907195369)
  - Run tests
- other_os (ID 3907195431)
  - Compile all architectures test
- go1.14 (ID 3907195496)
  - Race test
- go1.15 (ID 3907195576)
  - Race test
- go1.16 (ID 3907195648)
  - Race test

ANNOTATIONS
X golangci-lint exit with code 4

Activity

  1. Vampire commented on Apr 3, 2023

    @Vampire

    Maybe an alternative or additional option could be to hide successful steps, so that you can see which are failed, which are still running and which are yet to be executed.

  2. vilmibm commented on Apr 4, 2023

    @vilmibm
    Contributor

    Sounds great to me.

    I'd propose that it be shortened to this with the --compact flag, where what is showing is the current step only, or if it has finished, the first failing step, otherwise the last step.

    let's start here.

  3. babakks commented on May 19, 2025

    @babakks
    Member

    @iamazeem, Thanks for submitting the PR for this issue! 🙏

    However, as I was reviewing your PR, I noticed we need an A/C on this, since there are a few edge/special cases. Also, I think we can achieve a better experience with a few simple improvements to your PR, which is already a good base to build on.

    I know this issue started with the idea of just showing the running steps, but as a user I'd expect the --compact mode to provide me with a terse and yet informative representation of my workflow run. I might not be interested to see all future steps, or all passed ones, but I would like to see the failed ones (which can be more than one step; have a look at this run for such a case). Also, I don't need to see the steps of a completed job if all steps has been successful.

    I'm going to propose what I think is a good experience for the --compact option and then we can discuss it with other folks in the team to derive the A/C for this issue.

    Proposed experience

    Let's say I have workflow run in progress. I'd expect the --compact mode to show me the live report applying these rules:

    • If a job is completed:
      • If all steps were successful, only show the job name.
      • If the job has failed steps, show the job name and the failed steps.
    • If a job is still in progress:
      • If no step has failed, only show the job name and the currently running step.
        • GH Actions does not support parallel running steps, but this can change someday. So, I'd like to see all running steps, if there are more than one.
      • If one or more steps has failed, show the job name, the failed steps, and the current running step, in a chronological order.

    Also, since the underlying code is shared between run watch and run view, we can add the --compact option to run view as well.

    @williammartin @andyfeller @BagToad What do you think?

  4. BagToad commented on May 20, 2025

    @BagToad
    Member

    I discussed this with @babakks and it makes total sense to me! It doesn't seem all that different to the current implementation; there's just a few differences that I think make sense for a compact output.

  5. babakks commented on May 21, 2025

    @babakks
    Member

    So, I'm putting down an A/C for this.

    Acceptance Criteria

    1. Successful job

    Given I have a workflow running, with a job that is completed without any failed steps
    When I run gh run watch --compact
    Then The job is displayed (among others) as a single line with a green pass marker and no last/final step

    2. Completed job with failed steps

    Given I have a workflow running, with a job that is completed with one or more failed steps
    When I run gh run watch --compact
    Then The job is displayed (among others) with a red failure marker, followed by failed steps nested from it

    3. Ongoing job

    Given I have a workflow running, with a job that is not yet completed, and without any failed steps
    When I run gh run watch --compact
    Then The job is displayed (among others) as a single line with an asterisk marker, followed by the only running step nested from it

    4. Ongoing job with failed steps

    Given I have a workflow running, with a job that is not yet completed, but has one or more failed steps
    When I run gh run watch --compact
    Then The job is displayed (among others) as a single line with an asterisk marker, followed by the failed steps and the only running step nested from it

  6. babakks commented on May 21, 2025

    @babakks
    Member

    @iamazeem I made the above A/C to clear up different scenarios. Now I think we can update the PR.

    FWIW I made this workflow to help with simulating failed steps, and a sleep per step to be able to check run watch when it's running. For example, you can manually trigger the workflow with an input like TFTFT to make certain steps fail/pass (F for fail). Feel free to use it if you find it helpful.

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-runrelating to the gh run command

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions