Back to Autogpt

GitHub Commits

docs/integrations/block-integrations/github/commits.md

0.6.443.3 KB
Original Source

GitHub Commits

<!-- MANUAL: file_description -->

Blocks for listing commit history and creating multi-file commits in GitHub repositories.

<!-- END MANUAL -->

Github List Commits

What it is

This block lists commits on a branch in a GitHub repository.

How it works

<!-- MANUAL: how_it_works -->

This block fetches commits from a GitHub repository using the Commits API. You can filter by branch name and control the number of results with pagination parameters.

Each commit entry includes the SHA, commit message, author name, date, and a URL to view the commit on GitHub.

<!-- END MANUAL -->

Inputs

InputDescriptionTypeRequired
repo_urlURL of the GitHub repositorystrYes
branchBranch name to list commits fromstrNo
per_pageNumber of commits to return (max 100)intNo
pagePage number for paginationintNo

Outputs

OutputDescriptionType
errorError message if listing commits failedstr
commitA commit with its detailsCommit
commitsList of commits with their detailsList[CommitItem]

Possible use case

<!-- MANUAL: use_case -->

Activity Monitoring: Track recent commits on a branch to monitor development progress.

Changelog Generation: Retrieve commit messages to automatically compile release notes or changelogs.

Audit Trail: List commits to review who made changes and when for compliance purposes.

<!-- END MANUAL -->

Github Multi File Commit

What it is

This block creates a single commit with multiple file upsert/delete operations using the Git Trees API.

How it works

<!-- MANUAL: how_it_works -->

This block creates a single atomic commit that can add, update, or delete multiple files at once using the low-level Git Trees API. It fetches the latest commit SHA on the target branch, creates blobs for each upserted file concurrently, builds a new tree with all file operations, creates a commit pointing to that tree, and updates the branch reference.

For delete operations, a null SHA is set in the tree entry to remove the file. This approach is more efficient than making separate commits per file and ensures all changes land in a single commit.

<!-- END MANUAL -->

Inputs

InputDescriptionTypeRequired
repo_urlURL of the GitHub repositorystrYes
branchBranch to commit tostrYes
commit_messageCommit messagestrYes
filesList of file operations. Each item has: 'path' (file path), 'content' (file content, ignored for delete), 'operation' (upsert/delete)List[FileOperationInput]Yes

Outputs

OutputDescriptionType
errorError message if the commit failedstr
shaSHA of the new commitstr
urlURL of the new commitstr

Possible use case

<!-- MANUAL: use_case -->

Automated Code Generation: Commit generated code, configuration files, and scaffolding in a single atomic operation.

Batch File Updates: Update multiple configuration or documentation files across a repository in one commit.

Cleanup Operations: Delete obsolete files while adding replacements in a single commit to keep history clean.

<!-- END MANUAL -->