Category: github

The problem I’m trying to solve: how to create PRs for multiple GitHub repositories and then merge those repos via CLI—without using the GitHub UI! I decided to take advantage of GitHub’s Hub, which GitHub describes as “an extension to command-line git” to create the pull requests, and then use GitHub’s API to merge those PRs.

To solve the problem, I developed this Bash script to create the Pull Requests (Note that anything in less than/greater than brackets needs to be altered to match your setup): This script lives at the root of a directory that contains several repos.

That generated script will be called merge_all-.sh and will contain several curl commands that use the GitHub API to then merge the PRs.

Here’s what that .env file looks like: If everything goes well after running the pull request creation script, you should have a script that looks somewhat like this: If this helps you out at all, then congrats on all the time you’ll save not having to manually merge individual repos in the GitHub GUI 🙂

Related Articles