Bump actions/cache from 3 to 4 #311
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: Dependabot auto-merge | |
on: pull_request_target | |
jobs: | |
waiter: | |
runs-on: ubuntu-latest | |
if: github.actor == 'dependabot[bot]' | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/github-script@v6 | |
with: | |
script: | | |
const wait = (ms) => new Promise(resolve => setTimeout(() => resolve('done'), ms)); | |
let workflowPending = true; | |
while (workflowPending) { | |
await wait(10000); | |
let { data: { check_runs } } = await github.rest.checks.listForRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: '${{ github.event.pull_request.head.ref }}' | |
}); | |
console.log(check_runs); | |
if (check_runs.length === 0) { | |
continue; | |
} | |
workflowPending = !check_runs | |
.filter(({ name }) => !['waiter', 'dependabot'].includes(name) ) | |
.every(({ conclusion, status }) => status === 'completed' && ['success', 'skipped'].includes(conclusion)); | |
} | |
dependabot: | |
runs-on: ubuntu-latest | |
if: github.actor == 'dependabot[bot]' | |
needs: [waiter] | |
permissions: | |
pull-requests: write | |
contents: write | |
steps: | |
- name: Dependabot metadata | |
id: metadata | |
uses: dependabot/[email protected] | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Enable auto-merge for Dependabot PRs | |
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor'}} | |
run: gh pr merge --auto --rebase "$PR_URL" | |
env: | |
PR_URL: ${{github.event.pull_request.html_url}} | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |