Tool

Get file contents

The GitHub Get File Contents tool allows users to retrieve the contents of files or directories directly from any GitHub repository. It supports specifying branches, tags, pull requests, or specific commits to access the exact version of the file or directory you need.

GitHub

Features

  • Fetch file or directory contents from any public GitHub repository.
  • Specify the repository owner and repository name to target the desired project.
  • Use optional parameters to specify git references such as branches, tags, pull requests, or commit SHAs.
  • Supports retrieving entire directories by specifying paths ending with a slash '/'
  • Read-only access ensuring safe extraction of content without modifying the source repository.

Benefits

  • Easily access and review code or documentation without cloning the repository.
  • Improve development workflow by programmatically retrieving files on demand.
  • Supports integration with automation tools that require GitHub file data.
  • Facilitates code audits, reviews, and content analysis directly from GitHub.
  • Saves time and resources by avoiding unnecessary repository cloning.

Description

Get the contents of a file or directory from a GitHub repository

Parameters

5 parameters

NameTypeDescription
ownerrequiredstring

Repository owner (username or organization)

pathstring

Path to file/directory (directories must end with a slash '/')

refstring

Accepts optional git refs such as refs/tags/{tag}, refs/heads/{branch} or refs/pull/{pr_number}/head

reporequiredstring

Repository name

shastring

Accepts optional commit SHA. If specified, it will be used instead of ref

Ready to vibe automate?

Join thousands of people who have transformed their workflows.

Workflows

Automations with AI agents

Collections

All your data, searchable

Chat Widget

Drop-in widget for your website

Developer API

Build AI-powered apps with ease

    We use cookies to enhance your experience on Needle and keep your data secure. Privacy Policy