Create a Bash Script to Open a Pull Request on Github using getopts

Share this video with your friends

Send Tweet

In this lesson, we’ll apply our knowledge of getopts and create a script that opens a PR on Github, all without leaving your terminal. We’ll use getopts to take 3 options: username, password or token, and PR title. We’ll use any input after that as the body of the PR. We’ll validate the input and then use curl to POST it to Github.