Skip to content

gh run rerun --failed fails with "its workflow file may be broken" when workflow not finished yet #9221

@findepi

Description

@findepi

Describe the bug

When gh run rerun --failed is invoked on a workflow that did not complete yet (and thus is not re-runnable at least in the web UI), the command prints "run .... cannot be rerun; its workflow file may be broken", which does not indicate actual reason of the failure

$ gh --version
gh version 2.50.0 (2024-05-29)
https://github.com/cli/cli/releases/tag/v2.50.0

Steps to reproduce the behavior

  1. Create a workflow with multiple jobs so that one fails and one continues to run longer
  2. Create a PR, wait for the to-be-failed job to fail
  3. Obtain status checks for this PR e.g. with gh pr checks "${pr_link}" --json 'link,bucket' --jq 'map(. | select(.bucket == "fail")' -- the job is reported as failed
  4. Obtain the run ID -- either from web UI or with something like gh pr checks "${pr_link}" --json 'link,bucket' --jq 'map(. | select(.bucket == "fail") | .link | sub(".*/runs/(?<id>[0-9]+)/job/[0-9]+$"; "\(.id)") ) | unique | .[]'
  5. Attempt re-running the failed jobs: gh run rerun --failed "${run_id}"

Expected vs actual behavior

Expected: gh run rerun to print something indicating that workflow/run cannot be rerun before it finishes
Actual: message not indicating what the actual problem is

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-runrelating to the gh run commandhelp wantedContributions welcomep3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions