This GitHub Action automates the git bisect
process to help identify the commit that introduced a regression or bug in your project. By automating the bisect process, you can quickly pinpoint the exact commit causing the issue without manually checking each potential commit.
Click on the Fork button at the top right of the GitHub repository page. This creates a personal copy of the repository where you can experiment with the actions.
- Test repository name: SrgGitRecordsRepo develop branch
- first bad commit in SrgGitRecordsRepo, it should show up in the Action result summary.
- Result from an sample repo: https://github.com/SweetRainGarden/SrgGactionGittoolsRepo/actions/runs/8410715233
- Automatically performs a binary search on your commit history to find the faulty commit.
- Configurable for different repositories, branches, and Java environments.
- Outputs the result directly in the GitHub Actions summary for easy access and review.
gh_token
: Optional. Your GitHub token for cloning and accessing the repository. If not provided, the default GitHub token is used. For public repository, the gh_token is not required.org_repo
: Required. The organization and repository name (e.g.,org/repo
) where the bisect should be run.init_branch_name
: Required. The branch name where the bisect process will start, defaulting to "develop".good_commit
: Required. The commit hash that is known to be good.bad_commit
: Optional. The commit hash suspected to be bad. If not provided, defaults to the latest commit of theinit_branch_name
.check_commands
: Required. Commands to test each commit, separated by "&&".java_version
: Optional. The Java version to use for the build, defaulting to '17'.
- Navigate to the
Actions
tab in your GitHub repository. - Click on
New workflow
and find theAutomated Git Bisect
workflow, or select it if already present. - Click on
Run workflow
. - Fill in the required input parameters:
org_repo
: "SweetRainGarden/SrgGitRecordsRepo"init_branch_name
: "develop"good_commit
: A known good commit hash.check_commands
: The commands to run for testing, like./gradlew clean && ./gradlew test
.- Optionally, specify the
bad_commit
andjava_version
if needed.
- Click on
Run workflow
to start the bisect process.
The action will then check out the specified branch, set up the required Java and Gradle environment, and start the git bisect
process using the provided commands to determine the good and bad commits.
- The workflow will summarize the bisect results in the GitHub Actions summary, including:
- The first bad commit ID.
- A diff URL to view the changes in that commit.
- The error log extracted from the bisect output.
Contributions to this GitHub Action are welcome. You can contribute by improving the scripts, adding features, or documenting use cases.
This GitHub Action is released under the MIT License. See LICENSE for more details.