Skip to content

gh run rerun --job is not working as documented #8967

@sochotnicky

Description

@sochotnicky

Describe the bug

This is what gh run rerun -h help looks like in the most recent version:

$ gh run rerun  -h
Rerun an entire run, only failed jobs, or a specific job from a run.

Note that due to historical reasons, the `--job` flag may not take what you expect.
Specifically, when navigating to a job in the browser, the URL looks like this:
`https://github.com/<owner>/<repo>/actions/runs/<run-id>/jobs/<number>`.

However, this `<number>` should not be used with the `--job` flag and will result in the
API returning `404 NOT FOUND`. Instead, you can get the correct job IDs using the following command:

	gh run view <run-id> --json jobs --jq '.jobs[] | {name, databaseId}'


USAGE
  gh run rerun [<run-id>] [flags]

FLAGS
  -d, --debug        Rerun with debug logging
      --failed       Rerun only failed jobs, including dependencies
  -j, --job string   Rerun a specific job from a run, including dependencies

INHERITED FLAGS
      --help                     Show help for command
  -R, --repo [HOST/]OWNER/REPO   Select another repository using the [HOST/]OWNER/REPO format

LEARN MORE
  Use `gh <command> <subcommand> --help` for more information about a command.
  Read the manual at https://cli.github.com/manual

Specifically, one of the flags is -j (or --job) to rerun a job with specific name. However:

$ gh run rerun 1234 --job anyname
specify only one of `<run-id>` or `--job`

Usage:  gh run rerun [<run-id>] [flags]

Flags:
  -d, --debug        Rerun with debug logging
      --failed       Rerun only failed jobs, including dependencies
  -j, --job string   Rerun a specific job from a run, including dependencies

I haven't yet looked at the code but seems to me that arg parsing is wrong? Rerunning a job name without providing a run number does not make sense I believe.

Steps to reproduce the behavior

  1. Run 'gh run rerun 1234 --job anyname'
  2. See error during parsing of arguments

Expected vs actual behavior

I'd expect to be able to re-run a job with specific from a given run with --job switch

Logs

Paste the activity from your command line. Redact if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-runrelating to the gh run commandhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions