Skip to content

gh pr lock does not accept url even though it is mentioned in the manual #8816

Description

@alvinsjoy

Describe the bug

The gh pr lock {<number> | <url>} [flags] command is meant to accept pull request urls as per the manual but does accept them and shows an error: invalid issue format: "https://github.com/user/repo/pull/60".

image
The screenshot provided shows the command and the error.

gh version 2.43.1 (2024-01-31)

Steps to reproduce the behavior

  1. Type gh pr lock "https://github.com/username/repo/pull/number" using valid username, repo, pull request number.

Expected vs actual behavior

The gh pr lock command should accept url to the pr just like gh pr merge command accepts urls.

Logs

C:\dev\projects\GitHub\PortfolioWebsite>gh pr lock "https://github.com/alvinsjoy/PortfolioWebsite/pull/60" --reason reso
lved
invalid issue format: "https://github.com/alvinsjoy/PortfolioWebsite/pull/60"
C:\dev\projects\GitHub\PortfolioWebsite>gh --version
gh version 2.43.1 (2024-01-31)
https://github.com/cli/cli/releases/tag/v2.43.1

Activity

  1. changed the title [-]gh pr lock does not accept url even though it is mentioned in the manual[/-] [+]`gh pr lock` does not accept url even though it is mentioned in the manual[/+] on Mar 14, 2024
  2. williammartin commented on Mar 14, 2024

    @williammartin
    Member

    Agree this is a bug. The functionality backing this is expecting you to provide the issue URL rather than the PR URL i.e.

    gh pr lock "https://github.com/alvinsjoy/PortfolioWebsite/issues/60" --reason resolved
    

    This regex is no bueno:

    var issueURLRE = regexp.MustCompile(`^/([^/]+)/([^/]+)/issues/(\d+)`)

    I'll mark this as help wanted.

  3. added
    priority-3Affects a small number of users or is largely cosmetic
    and removed on Mar 14, 2024
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