Skip to content

Instantly share code, notes, and snippets.

@Clumsy-Coder
Last active August 6, 2020 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Clumsy-Coder/7682c2a57882729d101a9dc612ae642f to your computer and use it in GitHub Desktop.
Save Clumsy-Coder/7682c2a57882729d101a9dc612ae642f to your computer and use it in GitHub Desktop.
Dependabot Automerge github action workflow
name: Dependbot Automerge
on:
pull_request:
types: ['opened']
jobs:
Automerge:
# provided by https://github.com/dependabot/dependabot-core/issues/2268#issuecomment-654608325
runs-on: ubuntu-latest
if: |
startsWith(github.actor, 'dependabot') &&
github.event_name == 'pull_request' &&
(startsWith(github.event.pull_request.title, 'build(deps):') ||
startsWith(github.event.pull_request.title, 'build(devDep):'))
steps:
- name: '@dependabot squash and merge'
uses: actions/github-script@v2
with:
github-token: ${{secrets.GH_TOKEN_DEPENDABOT}}
script: |
await github.issues.createComment({
owner: context.repo.owner,
repo: context.payload.repository.name,
issue_number: context.payload.pull_request.number,
body: '@dependabot squash and merge'
})
@Clumsy-Coder
Copy link
Author

Note: Personal Access token needs to be created for this to work.
Store the personal access token as a repo secret with the name GH_TOKEN_DEPENDABOT

Public repo

image

Private repo

image

Credit: @UziTech

@Clumsy-Coder
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment