Skip to content

Commit c6f5f7f

Browse files
committed
fix tailing
1 parent 2ff2d4f commit c6f5f7f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/github/actions.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"net/http"
88
"strconv"
9+
"strings"
910

1011
buffer "github.com/github/github-mcp-server/pkg/buffer"
1112
ghErrors "github.com/github/github-mcp-server/pkg/errors"
@@ -762,11 +763,11 @@ func downloadLogContent(logURL string, tailLines int) (string, int, *http.Respon
762763
return "", 0, httpResp, fmt.Errorf("failed to process log content: %w", err)
763764
}
764765

765-
if len(processedInput) > tailLines {
766-
processedInput = processedInput[len(processedInput)-tailLines:]
766+
lines := strings.Split(processedInput, "\n")
767+
if len(lines) > tailLines {
768+
lines = lines[len(lines)-tailLines:]
767769
}
768-
769-
finalResult := processedInput
770+
finalResult := strings.Join(lines, "\n")
770771

771772
return finalResult, totalLines, httpResp, nil
772773
}

0 commit comments

Comments
 (0)