8000 fix pr parsing · github/github-mcp-server@1528473 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1528473

Browse files
tonytrgSamMorrowDrums
authored andcommitted
fix pr parsing
1 parent 6fa8eaf commit 1528473

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/github/repositories.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,9 @@ func GetFileContents(getClient GetClientFn, getRawClient raw.GetRawClientFn, t t
464464

465465
rawOpts := &raw.RawContentOpts{}
466466

467-
if strings.HasPrefix(path, "refs/pull/") {
468-
prNumber, ok := strings.CutPrefix(path, "refs/pull/")
469-
if ok && len(prNumber) > 0 {
467+
if strings.HasPrefix(ref, "refs/pull/") {
468+
prNumber := strings.TrimSuffix(strings.TrimPrefix(ref, "refs/pull/"), "/head")
469+
if len(prNumber) > 0 {
470470
// fetch the PR from the API to get the latest commit and use SHA
471471
githubClient, err := getClient(ctx)
472472
if err != nil {

0 commit comments

Comments
 (0)
0