Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improvements & refactoring of get_file_contents#1582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
almaleksia wants to merge5 commits intomain
base:main
Choose a base branch
Loading
fromalmaleksia/get_file_contents_fixes

Conversation

@almaleksia
Copy link
Contributor

This PR contains refactoring of get_file_contents tool that eliminates errorfile content SHA is nil, if a directory was requested, path parameters should end with a trailing slash '/'

We shouldn't fail when trailing slash is not supplied. Also, for both directories and files the same API call is being used, therefore there's no need for two separate logical paths.

I removed the reliance on trailing slash and branching related to it. Instead, if GetContents returns directory content - we return it, if it is a file - we proceed with downloading etc.

@almaleksiaalmaleksia requested a review froma team as acode ownerDecember 12, 2025 10:50
CopilotAI review requested due to automatic review settingsDecember 12, 2025 10:50
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull request overview

This PR refactors theget_file_contents tool to eliminate the requirement for directory paths to end with a trailing slash. The refactoring unifies the code path for both files and directories by first calling the GitHub Contents API to determine the type, then proceeding accordingly.

Key Changes:

  • Removed the trailing slash requirement from the path parameter description
  • Unified the GetContents API call for both files and directories instead of having separate conditional logic
  • Simplified control flow by checking the response type (file vs directory) after the API call rather than before

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

FileDescription
pkg/github/repositories.goRefactored GetFileContents function to remove trailing slash dependency and unify the API call path for files and directories; updated parameter description
pkg/github/toolsnaps/get_file_contents.snapUpdated tool schema snapshot to reflect the changed path parameter description

tommaso-moro
tommaso-moro previously approved these changesDec 12, 2025
Copy link
Contributor

@tommaso-morotommaso-moro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

left a comment but otherwise lgtm!

SamMorrowDrums
SamMorrowDrums previously approved these changesDec 12, 2025
@almaleksiaalmaleksiaforce-pushed thealmaleksia/get_file_contents_fixes branch fromf4a7585 toa3460a9CompareDecember 12, 2025 16:31
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@tommaso-morotommaso-morotommaso-moro approved these changes

@SamMorrowDrumsSamMorrowDrumsSamMorrowDrums left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@almaleksia@SamMorrowDrums@tommaso-moro

[8]ページ先頭

©2009-2025 Movatter.jp