Dependabot #16816
This file contains hidden or 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 | |
| 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 }} |