Skip to content

gh run cancel needs input validation #7638

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".

Activity

  1. barrettj12 commented on Jun 29, 2023

    @barrettj12
    Author

    While I'm here, it would be nice to add more information to the success message. Currently it just says

    ✓ Request to cancel workflow submitted.
    

    Maybe we could add the workflow ID here?

    ✓ Request to cancel workflow 500163252 submitted.
    
  2. samcoe commented on Jun 30, 2023

    @samcoe
    Contributor

    @barrettj12 Both those suggestions would make good improvements I think 👍 I'll open this up for contributions.

  3. added
    priority-3Affects a small number of users or is largely cosmetic
    and removed on Jun 30, 2023
  4. rajhawaldar commented on Jun 30, 2023

    @rajhawaldar
    Contributor

    @samcoe I will take this ahead.

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

    bugSomething isn't workinghelp wantedContributions welcomepriority-3Affects 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