Last active
August 6, 2020 17:40
-
-
Save Clumsy-Coder/7682c2a57882729d101a9dc612ae642f to your computer and use it in GitHub Desktop.
Dependabot Automerge github action workflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Private repo
Credit: @UziTech