Skip to content

gh run cancel needs input validation #7638

@barrettj12

Description

@barrettj12

Describe the bug

gh run cancel doesn't validate the run_id passed in, which can result in some weird error messages.

$ gh --version
gh version 2.30.0 (2023-05-30)
https://github.com/cli/cli/releases/tag/v2.30.0

Steps to reproduce the behavior

Pass in a multiline string as the run_id to gh run cancel, e.g.

$ gh run cancel -R barrettj12/juju '5000
> 5000'
parse "https://api.github.com/repos/barrettj12/juju/actions/runs/5000\n5000?exclude_pull_requests=true": net/url: invalid control character in URL

Expected vs actual behavior

Return a reasonable error such as invalid run_id "5000\n5000".

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp 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