Auto approve and merge pull requests by Dependabot using Github actions

Dileep Kumar Jami
1 min readMar 23, 2020

--

Are you tired of manually approving and merging the pull requests raised by Dependabot? then this is for you.

In this blog, we will look at the automation of the above process using Github actions.

Just to set the context,

Dependabot checks dependency files regularly for outdated requirements and security vulnerabilities and opens individual pull requests automatically by providing the fixes.

Github actions allows us to create workflows and thus automate the process of events like building, testing, deploying projects on various platforms and much more.

In order to automate the process, we need to configure a workflow which includes two jobs, one to approve the PR, the other to merge the PR automatically.

Please follow the steps below to create the work flow.

  1. At the root of the project, create a yaml file under .github/workflows/auto-approve-n-merge.yml

2. Copy and paste the content of the below file.

auto-approve-n-merge.yml

3. Once it is done, just commit and push the file and we are done. Whenever any PR is raised by Dependabot, the workflow would be automatically triggered and hence the PRs would be auto approved and merged. (Please go through the comments to understand the workflow better)

Note: Kindly go through the documentation and the limitations of the both the custom actions (AutoApprove, AutoMerge) to understand the entire action and its specifications.

If you find this post interesting or useful, please hit the clap button and share so as to reach others.

--

--