Auto-Ask Rultor to Merge Pull Requests from Robots
This simple script may help you deal with pull requests coming to your GitHub repositories from robots:
gem install mergem
Then, run it locally and read its output:
mergem --repo yegor256/mergem --verbose --token <YOUR_GITHUB_TOKEN>
First, it will find all pull requests in yegor256/mergem
GitHub repository,
which were not yet discussed by the owner of the token. Then, it will ignore
those pull requests that are coming not
from Renovate
or Dependabot. Then, it will
post @rultor please, try to merge
text message to each pull
request left in the list.
Token
mergem
requires a GitHub token to be passed via the --token
option.
To obtain one, go to your GitHub account, then navigate to "Settings," and then
to "Developer Settings".
Classic Token
You can create a classic token with the public_repo
("Access public
repositories") scope. It will grant mergem
all the necessary permissions to
read and write comments on repositories.
Fine-grained Token
Another option is to create a fine-grained token with "All Repositories" access. In this case, you will need to assign the following permissions to the token:
- Issues, "Read and write"
- Pull requests, "Read and write"
- Contents, "Read and write"
Please note that fine-grained tokens might encounter issues with repositories not owned by you or owned by an organization. In such cases, you may need to obtain additional approval from the organization.
During the beta, organizations must opt in to fine-grained personal access tokens. If your organization has not already opted-in, then you will be prompted to opt-in and set policies when you follow the steps below.
Read about setting a personal access token policy for your organization.
How to contribute
Read these guidelines. Make sure your build is green before you contribute your pull request. You will need to have Ruby 2.3+ and Bundler installed. Then:
bundle update
bundle exec rake
If it's clean and you don't see any error messages, submit your pull request.
In order to run a single test:
bundle exec ruby test/test_askrultor.rb