Merge pull request #8837 from t4kamura/fix-cannot-lock-pr-url
Fixed `gh pr lock/unlock` not working when URL is passed
This commit is contained in:
commit
0a2ede0279
2 changed files with 18 additions and 1 deletions
|
|
@ -100,7 +100,7 @@ func IssuesFromArgsWithFields(httpClient *http.Client, baseRepoFn func() (ghrepo
|
|||
return issues, issuesRepo, nil
|
||||
}
|
||||
|
||||
var issueURLRE = regexp.MustCompile(`^/([^/]+)/([^/]+)/issues/(\d+)`)
|
||||
var issueURLRE = regexp.MustCompile(`^/([^/]+)/([^/]+)/(?:issues|pull)/(\d+)`)
|
||||
|
||||
func issueMetadataFromURL(s string) (int, ghrepo.Interface) {
|
||||
u, err := url.Parse(s)
|
||||
|
|
|
|||
|
|
@ -79,6 +79,23 @@ func TestIssueFromArgWithFields(t *testing.T) {
|
|||
wantIssue: 13,
|
||||
wantRepo: "https://example.org/OWNER/REPO",
|
||||
},
|
||||
{
|
||||
name: "PR URL argument",
|
||||
args: args{
|
||||
selector: "https://example.org/OWNER/REPO/pull/13#comment-123",
|
||||
baseRepoFn: nil,
|
||||
},
|
||||
httpStub: func(r *httpmock.Registry) {
|
||||
r.Register(
|
||||
httpmock.GraphQL(`query IssueByNumber\b`),
|
||||
httpmock.StringResponse(`{"data":{"repository":{
|
||||
"hasIssuesEnabled": true,
|
||||
"issue":{"number":13}
|
||||
}}}`))
|
||||
},
|
||||
wantIssue: 13,
|
||||
wantRepo: "https://example.org/OWNER/REPO",
|
||||
},
|
||||
{
|
||||
name: "project cards permission issue",
|
||||
args: args{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue