Skip to main content
The GitHub Get repository content action retrieves files and folders from a GitHub repository at a specific path, branch, or commit reference. Use this read-only action to inspect code structure, documentation, or directory listings for analysis, summaries, or onboarding content generation.

Limitations

  • Access can get blocked by GitHub organization OAuth App access restrictions, returning a 403 error even when credentials are correct.

Prerequisites

  • Your admin must install and configure the GitHub connector, add the GitHub actions pack under Admin > Actions, and enable this action.
  • A GitHub app must be installed on the relevant organization(s) and linked to the correct GitHub datasource in the Glean admin console.
  • You must authenticate for GitHub actions so the action can run using your GitHub identity.

Supported parameters

NameTypeDescription
OwnerStringRepository owner.
RepositoryStringRepository name.
File pathStringFile or folder path within the repository.
Branch or commitStringBranch or commit reference to read content from.

Usage example

You want to create onboarding documentation for new contributors by examining the structure of the project’s documentation directory. Instruction to an agent: “Show me all files in the docs/ directory of the mycompany/backend repository on the main branch.” Resulting behavior:
  • Calls Get repository content with:
    • Owner set to “mycompany”.
    • Repository set to “backend”.
    • File path set to “docs/”.
    • Branch or commit set to “main”.
  • Retrieves repository content including:
    • List of files in the docs/ directory
    • File names and paths
    • File types (file vs directory)
    • File sizes
    • Download URLs for each file
  • Presents the directory structure to the user.
  • User can review the documentation files and decide which ones to include in the onboarding guide.
Workflow tip: Use this action to inspect repository structure before generating documentation or onboarding content. You can specify a branch or commit SHA to view content at a specific point in history. For private repositories, ensure the GitHub app has proper access permissions.

Troubleshooting

  • Possible cause: The GitHub organization has restricted third-party OAuth apps, so the app used by this action is not allowed to read repository contents even if credentials appear to be correct.
  • Fix: Ask your GitHub organization admin to enable the app or adjust OAuth App access restrictions for the relevant repositories.

FAQs

Yes, provided your GitHub connector and GitHub app are configured to access those private repositories and your authenticated identity has permission to read them.
Confirm that the owner, repository, file path, and branch or commit values exactly match what exists in GitHub. If the values are correct, verify that the GitHub app and your GitHub identity have read access to that path and repository.