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 Name | Description | Required |
---|---|---|
Repository Owner repo_owner | The owner of the repository. | yes |
Repository Name repo_name | The name of the repository. | yes |
Base base | The base commit. | yes |
Head head | The head commit. | yes |
Diff Type diff_type | The type of diff to return. Possible values: json , diff . Default: json . | - |
Returns
A JSON of the commit diff.
Required Secrets
Secret Placeholder | Description |
---|---|
GITHUB_SECRET | GitHub 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"}
)