{"id":13827226,"url":"https://github.com/salemove/github-review-helper","last_synced_at":"2025-12-29T23:45:14.272Z","repository":{"id":73124959,"uuid":"43648578","full_name":"salemove/github-review-helper","owner":"salemove","description":"GitHub bot for improving your project's PR review workflow","archived":false,"fork":false,"pushed_at":"2019-04-16T12:23:23.000Z","size":200,"stargazers_count":115,"open_issues_count":0,"forks_count":12,"subscribers_count":47,"default_branch":"master","last_synced_at":"2024-08-04T09:06:30.879Z","etag":null,"topics":["bot","fixup","github-webhooks","squash"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/salemove.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-10-04T19:00:56.000Z","updated_at":"2023-11-06T13:27:25.000Z","dependencies_parsed_at":"2024-01-15T16:22:35.957Z","dependency_job_id":"7930fdfe-39a5-4af3-a4a2-2b811a19503b","html_url":"https://github.com/salemove/github-review-helper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salemove%2Fgithub-review-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salemove%2Fgithub-review-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salemove%2Fgithub-review-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salemove%2Fgithub-review-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/salemove","download_url":"https://codeload.github.com/salemove/github-review-helper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225481316,"owners_count":17481172,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","fixup","github-webhooks","squash"],"created_at":"2024-08-04T09:01:52.298Z","updated_at":"2025-12-29T23:45:14.225Z","avatar_url":"https://github.com/salemove.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# github-review-helper\n\n[![Build Status](https://travis-ci.org/salemove/github-review-helper.svg?branch=master)](https://travis-ci.org/salemove/github-review-helper)\n[![Coverage](http://gocover.io/_badge/github.com/salemove/github-review-helper?0)](http://gocover.io/github.com/salemove/github-review-helper)\n[![GoDoc](https://godoc.org/github.com/salemove/github-review-helper?status.svg)](https://godoc.org/github.com/salemove/github-review-helper)\n\n## What?\n\n**See [here](doc/intro.md)** for a high-level introduction.\n\n**github-review-helper** is a little bot that you can set up GitHub hooks for to improve your project's PR review flow.\nIt currently does 4 things:\n\n1. It observes all PRs and detects if any `fixup!` or `squash!` commits are\n   included in the PR. If there are, it uses the GitHub status API to mark the\n   PR as **pending** with `review/squash` context. If there are no *fixup* or\n   *squash* commits, it marks the PR as **success**. This allows one to set the\n   `review/squash` **success** status as required in the repo's GitHub settings\n   to make sure no PR that includes *fixup* or *squash* commits gets\n   accidentally merged.\n2. It observes all PR comments (comments on the unified diff or the individual\n   commits don't count) and if it sees a command of `!squash`, it tries to\n   *autosquash* (equivalent of running `git rebase --interactive --autosquash`\n   manually and instantly closing and saving the interactive rebase editor) all\n   the commits in the PR. Success/failure will be reflected by the\n   `review/squash` status.\n3. Similarly to `!squash`, it also listens for `!check` commands. The `!check`\n   command can be used to force the bot to (re-)check the current PR for\n   `fixup!` and `squash!` commits. This can be useful when some webhooks didn't\n   reach the bot properly or when you have reason to believe that the bot\n   didn't correctly evaluate your PR automatically. Which can sometimes happen,\n   because the bot is fast and can at times fetch data from the GitHub API\n   before that data has been updated, causing the bot to make it's judgment\n   based on outdated data.\n4. It listens for `!merge` commands. `!merge` command will squash the PR\n   (exactly like `!squash` would) if needed and will then merge the PR as soon\n   as all required status checks are marked as \"success\". If any of the status\n   checks fail after that, the bot will cancel the merging process (indicated\n   by a 'merging' label on the PR) and will notify the PR's author.\n\n## Quick start\n### Create an access token for the bot\nThis step is nicely [covered in GitHub's own\ndocumentation](https://help.github.com/articles/creating-an-access-token-for-command-line-use/). Create a token\nfollowing the guide and mark it down.\n\n### Run the bot from a docker image\n```\ndocker run \\\n  -e GITHUB_ACCESS_TOKEN=\"the-access-token-you-created-above\" \\\n  -e GITHUB_SECRET=\"a-secret\" \\\n  -v ~/.ssh:/etc/secret-volume \\\n  -p 4567:80 \\\n  salemove/github-review-helper\n```\n\nNote that the snippet above mounts your local `~/.ssh` folder as a volume into\nthe Docker container. This is required for the bot to be able to connect to\nyour repositories using git. It will use the `known_hosts` file from that\nmounted folder for making sure that your connection to github.com is secure and\nthe `id_rsa` file for the SSH identity.\n\n### Install and start the bot (if you don't want to use docker)\nThe following commands expect you to have Go installed and your *GOPATH* to be properly set up. To compile and install\nthe bot, run the following commands:\n```\ngo get github.com/salemove/github-review-helper\ncd $GOPATH/github.com/salemove/github-review-helper\ngo install\n```\n\nThe bot requires some environment variables to be set for it to function. Let's quickly go over each one to see what it\nis and why it's needed.\n\n - `PORT`: The port the bot will be listening for connections on\n - `GITHUB_ACCESS_TOKEN`: The token we created in a previous step. This required to authenticate your account with\n   GitHub.\n - `GITHUB_SECRET`: Another secret token that we will later use to configure GitHub webhooks for the bot. This will help\n   us make sure that all the requests are coming only from GitHub. [GitHub\n   suggests](https://developer.github.com/webhooks/securing/#setting-your-secret-token) running `ruby -rsecurerandom -e\n   'puts SecureRandom.hex(20)'` to generate this token.\n\nNow let's start the bot (you can replace `$GOPATH/bin/github-review-helper` with just `github-review-helper` if you have\ngo executables on your path):\n```\n PORT=4567 GITHUB_ACCESS_TOKEN=\"the-acces-token-you-created-above\" GITHUB_SECRET=\"a-secret\" $GOPATH/bin/github-review-helper\n```\nPS: *The bot also needs git to be available on path and it expects the user the command is run under to have ssh access\nto the repositories it is used for.*\n\n### Set up a tunnel\nLeave the bot running and let's now set up a tunnel to localhost.  This example depends on [ngrok](https://ngrok.com/)\nbeing installed and available on the system (as do the official [GitHub webhook\ndocs](https://developer.github.com/webhooks/configuring/#using-ngrok)) to make the bot publicly accessible by GitHub. So\ngo ahead and install it if you haven't already. When you're done, you can create a tunnel by running:\n```\nngrok 4567\n```\nYou should see something like the following in the output:\n```\nForwarding    http://7e9ea9dc.ngrok.com -\u003e 127.0.0.1:4567\n```\nNote down the `http://*.ngrok.com` URL.\n\n### Configure the webhook\nTo set up a repository webhook on GitHub, head over to the **Settings** page of your repository, and click on **Webhooks \u0026\nservices**. After that, click on **Add webhook**. Then:\n\n - Enter the ngrok address you marked down earlier as the **Payload URL**\n - Leave **Content type** to be `application/json`\n - Enter the secret token you created before and used to start the bot as the **Secret**\n - Use the **Let me set individual events** option and select the **Issue comment**, **Pull Request**, and **Status**\n   events from the list that gets opened\n - Enable the webhook by leaving the **Active** checkbox checked\n\nClick on **Add webhook** to finish the process.\n\n*See the [GitHub\ndocumentation](https://developer.github.com/webhooks/creating/) on creating webhooks for more info.*\n\n### [Optional] Make `review/squash` **success** required\n\nIf you wish to have the merge button disabled for PRs with *fixup* and *squash* commits in them, then make this status\nrequired. This can be done by going to the repo's **Settings** on GitHub, then going to the **Branches** section and\nselecting the branch you wish to protect from the **Protected branches** dropdown (or clicking on **Edit** next to the\nbranch, if it's already protected). Now checking the **Require status checks to pass before merging** checkbox and then\nthe `review/squash` context from the displayed list. NB: The bot must have had a change to check at least one PR for the\ncontext to appear in the list.\n\n*See the [GitHub\ndocumentation](https://help.github.com/articles/enabling-required-status-checks/) for a visual guide.*\n\n### All set! Now try it out\nTo try it out you can make some changes to your code on a feature branch that you've opened a PR for. Then stage these\nchanges with `git add`. Now create a *fixup* commit for you current HEAD with `git commit --fixup=@` and push the\nchanges. You should see a *pending* status next to the *fixup* commit. (If you don't, check the **Recent Deliveries**\nsection in your webhook's settings to see what went wrong)\n\nNow to try squashing the *fixup* commit, try leaving a comment on the PR with a message of only `!squash`. The bot\nshould squash the *fixup* commit and push the new changes. It should also update the last commit's status to *success*\nsaying that all *fixup* commits have been successfully squashed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalemove%2Fgithub-review-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalemove%2Fgithub-review-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalemove%2Fgithub-review-helper/lists"}