Skip to main content
GitHub get a commit action retrieves details for a specific commit in a GitHub repository. This is a read-only action that returns commit metadata including author, committer, message, file changes, and parent commit references.

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.
  • The GitHub app must have read permissions to repository contents and metadata.

Supported parameters

ParameterTypeRequiredDescription
OwnerStringYesThe account owner of the repository (case-insensitive).
RepositoryStringYesThe name of the repository without the .git extension (case-insensitive).
Branch or commitStringYesThe branch name, tag, or commit SHA to retrieve (e.g., “main”, “v1.0.0”, or full SHA).
PageIntegerNoPage number for paginated file listings in the commit diff (default is 1).
Results per pageIntegerNoNumber of files per page in the commit diff (default is 30, maximum is 100).

Usage examples

  • “Show me the details of the most recent commit on the ‘main’ branch of the ‘octocat/Hello-World’ repository.”
  • “Get information about commit SHA ‘abc123def456’ in the ‘facebook/react’ repository.”
  • “What files were changed in the latest commit on the ‘develop’ branch of ‘microsoft/vscode’?”

Troubleshooting

  • Possible cause: The GitHub connector is not fully set up, the GitHub app is not installed on the target organization, or the app is missing read permissions to repository contents.
  • Fix: Confirm that the GitHub connector is installed and authenticated, that the GitHub app is installed on the correct organization(s), and that it has read permissions to repository contents and metadata. If using a custom app, verify that the contents:read permission is enabled.
  • Possible cause: The owner, repository name, or ref value is incorrect, the repository does not exist, or the authenticated user does not have access to it.
  • Fix: Verify that the repository exists at https://github.com/owner/repo and that the authenticated user has at least read access to it. Check for typos in the Owner, Repository, or Ref parameters.
  • Possible cause: The Ref parameter does not match any branch, tag, or commit SHA in the repository.
  • Fix: Verify that the branch or tag name is spelled correctly (branch and tag names are case-sensitive). If using a commit SHA, ensure you are using the full 40-character SHA or at least the first 7 characters. Use List commits to find valid commit SHAs if needed.
  • Possible cause: The GitHub organization has enabled OAuth App access restrictions, and the app used by this action is not allowed to access the repository.
  • Fix: Ask your GitHub organization admin to approve or allow the GitHub app used by this action for the relevant repositories, then retry.
  • Possible cause: The commit contains a very large number of file changes, and the response is paginated or truncated by GitHub’s API limits.
  • Fix: Use the Page and Per page parameters to retrieve additional pages of file changes. Note that GitHub may truncate diffs for extremely large commits (e.g., those with thousands of file changes).

FAQs

Yes. The Ref parameter accepts branch names, tag names, or commit SHAs. When you provide a branch name (e.g., “main”), the action returns the latest commit on that branch. When you provide a commit SHA, it returns that specific commit regardless of which branch it is on.
The author is the person who originally wrote the code changes, while the committer is the person who applied the commit to the repository. In most cases, these are the same person. However, when applying patches or rebasing commits, the author and committer may differ. Both fields include name, email, and timestamp.
This action retrieves individual commits by reference. To get commits from a pull request, first use Get a pull request to retrieve the PR’s head SHA, then use this action with that SHA as the Ref parameter. Alternatively, use List commits to get all commits within a date range or branch.
This action returns a list of files changed in the commit along with statistics (additions, deletions). To see the actual content changes (the diff), use Get repository content to retrieve the files at different commit references, or examine the patch/diff URLs in the response. GitHub may truncate diffs for very large commits.