|
| 1 | +name: Weekly dependency maintenance |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 9 * * 1" # Monday 9am UTC |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + pull-requests: write |
| 11 | + issues: write |
| 12 | + |
| 13 | +jobs: |
| 14 | + consolidate-deps: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Check for open Dependabot PRs |
| 18 | + id: check |
| 19 | + env: |
| 20 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 21 | + run: | |
| 22 | + count=$(gh pr list --repo "${{ github.repository }}" --author "app/dependabot" --state open --json number --jq length) |
| 23 | + echo "count=$count" >> "$GITHUB_OUTPUT" |
| 24 | + echo "Found $count open Dependabot PR(s)" |
| 25 | +
|
| 26 | + - name: Checkout |
| 27 | + if: steps.check.outputs.count != '0' |
| 28 | + uses: actions/checkout@v7 |
| 29 | + |
| 30 | + - name: Setup Ruby |
| 31 | + if: steps.check.outputs.count != '0' |
| 32 | + uses: ruby/setup-ruby@v1 |
| 33 | + with: |
| 34 | + ruby-version: "3.4" |
| 35 | + working-directory: runtimes/ruby |
| 36 | + bundler-cache: true |
| 37 | + |
| 38 | + - name: Install Claude Code |
| 39 | + if: steps.check.outputs.count != '0' |
| 40 | + run: npm install -g @anthropic-ai/claude-code |
| 41 | + |
| 42 | + - name: Consolidate dependency updates |
| 43 | + if: steps.check.outputs.count != '0' |
| 44 | + env: |
| 45 | + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} |
| 46 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 47 | + run: | |
| 48 | + claude -p "$(cat <<'PROMPT' |
| 49 | + You are maintaining the kulesh/recurgent repository. |
| 50 | +
|
| 51 | + 1. List open Dependabot PRs: gh pr list --author "app/dependabot" --state open --json number,title,body |
| 52 | + 2. For each PR, review the diff: gh pr diff <number> |
| 53 | + 3. Classify each as: |
| 54 | + - SAFE: patch/minor version bumps, lockfile-only, no breaking changes |
| 55 | + - NEEDS REVIEW: major version bumps, breaking changes, security advisories needing code changes |
| 56 | + 4. If there are SAFE PRs: |
| 57 | + a. Create a GitHub issue describing the consolidated update |
| 58 | + b. Create a branch from main and apply all safe changes |
| 59 | + c. Run `cd runtimes/ruby && bundle install` if any Ruby deps changed |
| 60 | + d. Commit, push, and create a PR following .github/pull_request_template.md |
| 61 | + e. Close superseded Dependabot PRs with a comment referencing the new PR |
| 62 | + 5. If any PRs NEED REVIEW, comment on them explaining the concern so a human can decide. |
| 63 | + 6. If no Dependabot PRs are open, exit saying no action needed. |
| 64 | + PROMPT |
| 65 | + )" --yes |
0 commit comments