Create a pull request on every push using Github Actions

Kushal Vithalani
3 min readApr 14, 2021


So, for the DevOps; Github is the most essential tool that a DevOps engineer will be working with daily. Github is basically a code hosting platform for version control and collaboration. It lets you and your team work together on projects from anywhere...Now the role of the DevOps engineer is to decide and automate the workflow using the GitHub actions to reduce the manual process.

▹ What is Github Pull Request?

Let's take a simple example and understand what a Pull Request is!
While working in a team; a developer has developed his code and after pushing it onto the GitHub branch the developer wants to get his code reviewed by the team lead or any other team member. So, for that the developer will issue a pull request to another member of this team; then the other team member will review the code and then merge it into his own branch or master branch.

▹ Now, What are Github actions?

Github Actions helps you build, test, and deploy applications, and also you can use it to automate other tasks common to your developer workflows. Additionally, you can also manage issues, automate releases, collaborate with your user base, and more.

The implementation part:

Step 1: Go to

Step 2: Create a repository

Step 3: Add some files and commit. The files will be committed to the main branch.

Step 4: Now, create another branch.

Step 5: On the right corner click on your display image and go to settings.

Step 6: On the left pane search for a developer setting and click on it.

Step 7: Click on personal access Token and generate a token and give any name and copy your token.
You can view your Token only once so make sure that you don’t forget to paste your token in notepad++ or any other editor.

Step 8: Now go to your repository and click on settings on the right side.

Step 9: Inside settings; on the right side search for a secret option and click on it. Create a “new repository secret” and assign some name(for eg: GITHUB_TOKEN) and paste your copied Token and save your secret.

Step 10: Go to actions and click on New workflow and create your YAML file.

Example code Snippet: Perform the necessary changes in environment variables according to your configurations.

name: Pull Request on Branch Push

on: [ push ]

name: PullRequestAction
runs-on: ubuntu-latest
— name: Checkout Code
uses: actions/checkout@v2
— name: pull-request-action
uses: vsoch/pull-request-action@master
BRANCH_PREFIX: “kushal/”

Final Step: Test your action by pushing code on a branch and check for the automated pull request.

Hope this will help you!
Thanks and Happy learning :-)



Kushal Vithalani

Recommended from Medium