Skip to content

Dependabot

Dependabot #16816

Workflow file for this run

name: Dependabot
on:
workflow_dispatch: {}
schedule:
# random MM to avoid a load spike on GitHub Actions at 00:00
- cron: 34 * * * *
permissions:
contents: write
statuses: read
checks: read
jobs:
merge_prs:
name: "Merge PRs > 1 week old"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Merge PRs
run: |
set -e
# Merge the first Dependabot PR that was created more than a week ago and has all checks passing.
# We only merge one because we'll need to rebase after its merged, so we run this scheduled
# action once every hour.
for pr in `gh pr list --json number,author,createdAt --search "created:<=$(date -d "2 days ago" +"%Y-%m-%d") author:app/dependabot status:success" --jq '.[].number' | head -n 1`; do
if [ -n "$pr" ]; then
gh pr merge --squash "$pr"
fi
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}