auto approve + merge dependabot prs #2991
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_target: | |
branches: | |
- main | |
types: | |
- labeled | |
- synchronize | |
check_suite: | |
types: | |
- completed | |
status: {} | |
jobs: | |
debug: | |
name: Debug | |
runs-on: ubuntu-latest | |
steps: | |
- uses: hmarr/debug-action@v3 | |
auto-approve: | |
name: Auto approve Dependabot PRs | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
needs: debug | |
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/auto-approve-action@v4.0.0 | |
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/fetch-metadata@v2.2.0" | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Wait for status checks | |
id: wait-for-status-checks | |
uses: "wyrihaximus/github-action-wait-for-status@v1.8.0" | |
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/automerge-action@v0.16.4" | |
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" |