Integrations
GitHub
APIs
Compare Two GitHub Commits

Compare Two Commits

This method enables users to compare two commits in a GitHub repository. Events include who authored and committed the changes, and the changes made.

For more information on the API for comparing commits, see Compare two commits (opens in a new tab).

To use this API endpoint for a private repository, your GitHub token requires the following scopes:

For a Fine-grained token:

- "Contents" repository permissions (read)

Alternatively, for a Token (classic):

- repo

SDK Import:

from admyral.actions import compare_two_github_commits

Arguments

Argument NameDescriptionRequired
Repository Owner repo_ownerThe owner of the repository.yes
Repository Name repo_nameThe name of the repository.yes
Base baseThe base commit.yes
Head headThe head commit.yes
Diff Type diff_typeThe type of diff to return. Possible values: json, diff. Default: json.-

Returns

A JSON of the commit diff.

Required Secrets

Secret PlaceholderDescription
GITHUB_SECRETGitHub secret. See GitHub setup

SDK Example

commit_diff = compare_two_github_commits(
	repo_owner="admyral",
	repo_name="admyral",
	base="c87d91ae09596dd3e481d82df89f998f8cb3bda2",
	head="9da034326b7f14459471d57f6c03c755b673ab77",
	secrets={"GITHUB_SECRET": "your_github_secret"}
)