Skip to content

Instantly share code, notes, and snippets.

@danieldietrich
Created July 30, 2020 00:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danieldietrich/ebd657c50c777f722fdaa7cf6bdec599 to your computer and use it in GitHub Desktop.
Save danieldietrich/ebd657c50c777f722fdaa7cf6bdec599 to your computer and use it in GitHub Desktop.
GitHub Action: Automerge Dependabot Pull Requests
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
on: pull_request
jobs:
automerge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- uses: actions/github-script@v2
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const { repository: repo, pull_request: pr } = context.payload
github.pulls.createReview({
owner: repo.owner.login,
repo: repo.name,
pull_number: pr.number,
event: 'APPROVE'
})
github.pulls.merge({
owner: repo.owner.login,
repo: repo.name,
pull_number: pr.number
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment