auto approve + merge dependabot prs #3494
This file contains 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: auto approve + merge dependabot prs | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- labeled | |
- synchronize | |
check_suite: | |
types: | |
- completed | |
status: {} | |
jobs: | |
auto-approve: | |
name: Auto approve Dependabot PRs | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
if: | | |
( | |
github.event.pull_request.user.login == 'dependabot[bot]' || | |
github.event.pull_request.user.login == 'dependabot' || | |
github.event.pull_request.user.login == 'dependabot-preview[bot]' || | |
github.event.pull_request.user.login == 'dependabot-preview' | |
) && ( | |
github.actor == 'dependabot[bot]' || | |
github.actor == 'dependabot' || | |
github.actor == 'dependabot-preview[bot]' || | |
github.actor == 'dependabot-preview' | |
) | |
steps: | |
- uses: hmarr/[email protected] | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
auto-merge: | |
name: Auto merge Dependabot PRs | |
runs-on: ubuntu-latest | |
permissions: | |
checks: read | |
contents: write | |
pull-requests: write | |
statuses: read | |
needs: auto-approve | |
if: | | |
github.actor == 'dependabot[bot]' || | |
github.actor == 'dependabot' || | |
github.actor == 'dependabot-preview[bot]' || | |
github.actor == 'dependabot-preview' | |
steps: | |
- name: Retrieve Dependabot metadata | |
id: dependabot-metadata | |
uses: "dependabot/[email protected]" | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Wait for status checks | |
id: wait-for-status-checks | |
uses: "wyrihaximus/[email protected]" | |
with: | |
ignoreActions: "Auto merge Dependabot PRs" | |
checkInterval: 30 | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Auto merge | |
if: | | |
steps.wait-for-status-checks.outputs.status == 'success' && | |
steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' | |
id: automerge | |
uses: "pascalgn/[email protected]" | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
MERGE_LABELS: "automerge,!major" | |
MERGE_REMOVE_LABELS: "" | |
MERGE_METHOD: "squash" | |
MERGE_COMMIT_MESSAGE: "pull-request-title-and-description" | |
MERGE_FORKS: "false" | |
MERGE_RETRIES: "6" | |
MERGE_RETRY_SLEEP: "30000" | |
MERGE_REQUIRED_APPROVALS: "1" | |
UPDATE_METHOD: "rebase" |