# this workflow merges requests from Dependabot if tests are passing# ref https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions# and https://github.com/dependabot/fetch-metadataname: Auto-merge# `pull_request_target` means this uses code in the base branch, not the PR.on: pull_request_target# Dependabot PRs' tokens have read permissions by default and thus we must enable write permissions.permissions:contents: writepull-requests: writejobs:dependencies:runs-on: ubuntu-latestif: github.event.pull_request.user.login == 'dependabot[bot]'steps:- name: Fetch PR metadataid: metadatauses: dependabot/fetch-metadata@08eff52f33f11b29792d242ed87062144883395c # v2.4.0with:github-token: ${{ secrets.GITHUB_TOKEN }}- name: Wait for PR CI# Don't merge updates to GitHub Actions versions automatically.# (Some repos may wish to limit by version range (major/minor/patch), or scope (dep vs dev-dep), too.)if: contains(steps.metadata.outputs.package-ecosystem, 'npm')uses: lewagon/wait-on-check-action@0dceb95e7c4cad8cc7422aee3885998f5cab9c79 # v1.4.0with:ref: ${{ github.event.pull_request.head.sha }}repo-token: ${{ secrets.GITHUB_TOKEN }}wait-interval: 30 # secondsrunning-workflow-name: dependencies # wait for all checks except this oneallowed-conclusions: success,skipped,cancelled # all other checks must pass, being skipped or cancelled is not sufficient- name: Auto-merge dependabot PRs# Don't merge updates to GitHub Actions versions automatically.# (Some repos may wish to limit by version range (major/minor/patch), or scope (dep vs dev-dep), too.)if: contains(steps.metadata.outputs.package-ecosystem, 'npm')env:PR_URL: ${{ github.event.pull_request.html_url }}GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}# The "auto" flag will only merge once all of the target branch's required checks# are met. Configure those in the "branch protection" settings for each repo.run: gh pr merge --auto --squash "$PR_URL"