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

get_file_contents accepts a ref instead of just branch#558

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
tonytrg wants to merge4 commits intomain
base:main
Choose a base branch
Loading
fromtonytrg/add-flexible-ref

Conversation

tonytrg
Copy link
Contributor

@tonytrgtonytrg commentedJun 20, 2025
edited
Loading

#get_file_contents now accepts:

  • refs
  • sha

instead of just branches.

Closes:#539

@tonytrgtonytrg marked this pull request as ready for reviewJune 23, 2025 08:20
@CopilotCopilotAI review requested due to automatic review settingsJune 23, 2025 08:20
@tonytrgtonytrg requested a review froma team as acode ownerJune 23, 2025 08:20
Copy link
Contributor

@CopilotCopilotAI 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 expandsget_file_contents to accept arbitrary git refs and SHAs rather than only branches.

  • Replaces thebranch parameter withref andsha in the tool’s schema
  • UpdatesGetFileContents logic to handleref,sha, and special pull-request refs
  • Refreshes tests and snapshots to assertref/sha instead ofbranch

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

FileDescription
pkg/github/repositories.goSwapped outbranch schema, addedref/sha handling and PR logic
pkg/github/repositories_test.goUpdated tests to check forref/sha instead ofbranch
pkg/github/toolsnaps/get_file_contents.snapRemovedbranch from snapshot and addedref/sha properties
Comments suppressed due to low confidence (2)

pkg/github/repositories_test.go:84

  • There are no tests covering the newsha parameter or the pull-request ref branch. Consider adding a test case that passes asha directly and one for arefs/pull/<n>/head to verify the override logic.
"ref":   "refs/heads/main",

pkg/github/repositories.go:473

  • The code calls fmt.Errorf but I don't see an import for "fmt" in this diff. Please ensure that "fmt" is imported to avoid a compile error.
return nil, fmt.Errorf("failed to get GitHub client: %w", err)

@almaleksia
Copy link

Howdy 👋

Can we make the change backwards compatible because we depend on this tool:https://github.com/github/sweagentd/pull/3357

@@ -18,9 +14,17 @@
"description": "Path to file/directory (directories must end with a slash '/')",
"type": "string"
},
"ref": {
"description": "Accepts optional git refs such as `refs/tags/\u003ctag\u003e`, `refs/heads/\u003cbranch\u003e` or `refs/pull/\u003cpr_number\u003e/head`",
Copy link
Collaborator

@SamMorrowDrumsSamMorrowDrumsJun 23, 2025
edited
Loading

Choose a reason for hiding this comment

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

Suggested change
"description":"Accepts optional git refs such as `refs/tags/\u003ctag\u003e`, `refs/heads/\u003cbranch\u003e` or `refs/pull/\u003cpr_number\u003e/head`",
"description":"Accepts optional git refs such as `refs/tags/<tag>`, `refs/heads/<branch>` or `refs/pull/<pr_number>/head`",

This seems broken, these should just be regular angled brackets no? They shouldn't need Unicode markup.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@SamMorrowDrumsSamMorrowDrumsSamMorrowDrums left review comments

Copilot code reviewCopilotCopilot left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Visual Studio Copilot cannot retrieve files by tag
3 participants
@tonytrg@almaleksia@SamMorrowDrums

[8]ページ先頭

©2009-2025 Movatter.jp