Skip to content

Commit 305391c

Browse files
committed
Use int
1 parent 0867d89 commit 305391c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pkg/github/actions.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -640,18 +640,18 @@ func GetJobLogs(getClient GetClientFn, t translations.TranslationHelperFunc) (to
640640

641641
if failedOnly && runID > 0 {
642642
// Handle failed-only mode: get logs for all failed jobs in the workflow run
643-
return handleFailedJobLogs(ctx, client, owner, repo, int64(runID), returnContent, int16(tailLines))
643+
return handleFailedJobLogs(ctx, client, owner, repo, int64(runID), returnContent, tailLines)
644644
} else if jobID > 0 {
645645
// Handle single job mode
646-
return handleSingleJobLogs(ctx, client, owner, repo, int64(jobID), returnContent, int16(tailLines))
646+
return handleSingleJobLogs(ctx, client, owner, repo, int64(jobID), returnContent, tailLines)
647647
}
648648

649649
return mcp.NewToolResultError("Either job_id must be provided for single job logs, or run_id with failed_only=true for failed job logs"), nil
650650
}
651651
}
652652

653653
// handleFailedJobLogs gets logs for all failed jobs in a workflow run
654-
func handleFailedJobLogs(ctx context.Context, client *github.Client, owner, repo string, runID int64, returnContent bool, tailLines int16) (*mcp.CallToolResult, error) {
654+
func handleFailedJobLogs(ctx context.Context, client *github.Client, owner, repo string, runID int64, returnContent bool, tailLines int) (*mcp.CallToolResult, error) {
655655
// First, get all jobs for the workflow run
656656
jobs, resp, err := client.Actions.ListWorkflowJobs(ctx, owner, repo, runID, &github.ListWorkflowJobsOptions{
657657
Filter: "latest",
@@ -716,7 +716,7 @@ func handleFailedJobLogs(ctx context.Context, client *github.Client, owner, repo
716716
}
717717

718718
// handleSingleJobLogs gets logs for a single job
719-
func handleSingleJobLogs(ctx context.Context, client *github.Client, owner, repo string, jobID int64, returnContent bool, tailLines int16) (*mcp.CallToolResult, error) {
719+
func handleSingleJobLogs(ctx context.Context, client *github.Client, owner, repo string, jobID int64, returnContent bool, tailLines int) (*mcp.CallToolResult, error) {
720720
jobResult, resp, err := getJobLogData(ctx, client, owner, repo, jobID, "", returnContent, tailLines)
721721
if err != nil {
722722
return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to get job logs", resp, err), nil
@@ -731,7 +731,7 @@ func handleSingleJobLogs(ctx context.Context, client *github.Client, owner, repo
731731
}
732732

733733
// getJobLogData retrieves log data for a single job, either as URL or content
734-
func getJobLogData(ctx context.Context, client *github.Client, owner, repo string, jobID int64, jobName string, returnContent bool, tailLines int16) (map[string]any, *github.Response, error) {
734+
func getJobLogData(ctx context.Context, client *github.Client, owner, repo string, jobID int64, jobName string, returnContent bool, tailLines int) (map[string]any, *github.Response, error) {
735735
// Get the download URL for the job logs
736736
url, resp, err := client.Actions.GetWorkflowJobLogs(ctx, owner, repo, jobID, 1)
737737
if err != nil {
@@ -770,7 +770,7 @@ func getJobLogData(ctx context.Context, client *github.Client, owner, repo strin
770770
}
771771

772772
// downloadLogContent downloads the actual log content from a GitHub logs URL
773-
func downloadLogContent(logURL string, tailLines int16) (string, int16, *http.Response, error) {
773+
func downloadLogContent(logURL string, tailLines int) (string, int, *http.Response, error) {
774774
httpResp, err := http.Get(logURL) //nolint:gosec // URLs are provided by GitHub API and are safe
775775
if err != nil {
776776
return "", 0, httpResp, fmt.Errorf("failed to download logs: %w", err)
@@ -794,9 +794,9 @@ func downloadLogContent(logURL string, tailLines int16) (string, int16, *http.Re
794794
}
795795

796796
// trimContent trims the content to a maximum length and returns the trimmed content and an original length
797-
func trimContent(content string, tailLines int16) (string, int16) {
797+
func trimContent(content string, tailLines int) (string, int) {
798798
// Truncate to tail_lines if specified
799-
lineCount := int16(0)
799+
lineCount := 0
800800
if tailLines > 0 {
801801

802802
// Count backwards to find the nth newline from the end

0 commit comments

Comments
 (0)