|
| 1 | +name: Check Dependencies |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '0 2 * * *' |
| 6 | + workflow_dispatch: {} |
| 7 | + |
| 8 | +jobs: |
| 9 | + update-dependencies: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + permissions: |
| 12 | + contents: write |
| 13 | + pull-requests: write |
| 14 | + issues: write |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + token: ${{ secrets.VISION_AGENTS_GITHUB_TOKEN }} |
| 19 | + fetch-depth: 0 |
| 20 | + |
| 21 | + - name: Set up Python |
| 22 | + uses: actions/setup-python@v5 |
| 23 | + with: |
| 24 | + python-version: '3.12' |
| 25 | + |
| 26 | + - name: Install uv |
| 27 | + uses: astral-sh/setup-uv@v5 |
| 28 | + with: |
| 29 | + version: "latest" |
| 30 | + |
| 31 | + - name: Install Cursor CLI |
| 32 | + run: | |
| 33 | + curl https://cursor.com/install -fsS | bash |
| 34 | + echo "$HOME/.cursor/bin" >> $GITHUB_PATH |
| 35 | + |
| 36 | + - name: Configure git |
| 37 | + run: | |
| 38 | + git config --global user.name "github-actions[bot]" |
| 39 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 40 | + |
| 41 | + - name: Check and update dependencies with Cursor Agent |
| 42 | + env: |
| 43 | + CURSOR_API_KEY: ${{ secrets.CURSOR_API_KEY }} |
| 44 | + GH_TOKEN: ${{ secrets.VISION_AGENTS_GITHUB_TOKEN }} |
| 45 | + run: | |
| 46 | + cursor-agent -p "You are a dependency update bot. Your task is to check for outdated Python dependencies and create PRs to update them. |
| 47 | +
|
| 48 | + ## Step 1: Discover pyproject.toml files |
| 49 | + Find all pyproject.toml files in this repository, excluding .venv directories. |
| 50 | +
|
| 51 | + ## Step 2: Check for outdated dependencies |
| 52 | + For each pyproject.toml, extract dependencies from: |
| 53 | + - [project].dependencies |
| 54 | + - [project].optional-dependencies |
| 55 | + - [dependency-groups] |
| 56 | +
|
| 57 | + Skip packages that are workspace packages (listed in [tool.uv.sources] with workspace = true or path references like vision-agents-*, etc.). |
| 58 | +
|
| 59 | + For each external package, query PyPI (https://pypi.org/pypi/{package}/json) to get the latest version. |
| 60 | + |
| 61 | + Categorize updates into: |
| 62 | + - PATCH/MINOR: e.g., 1.2.0 -> 1.2.5 or 1.2.0 -> 1.3.0 |
| 63 | + - MAJOR: e.g., 1.2.0 -> 2.0.0 |
| 64 | +
|
| 65 | + ## Step 3: Create PR for patch/minor updates |
| 66 | + If there are patch/minor updates: |
| 67 | + 1. Create branch: deps/patch-minor-YYYYMMDD |
| 68 | + 2. Update pyproject.toml files with patch/minor version bumps only |
| 69 | + 3. Preserve exact formatting, extras, and markers |
| 70 | + 4. Respect override-dependencies in root pyproject.toml |
| 71 | + 5. Commit with message: 'chore: update dependencies (patch/minor)' |
| 72 | + 6. Push and create PR with: |
| 73 | + - Title: 'chore: update dependencies (patch/minor)' |
| 74 | + - Body: Table of updated packages with old -> new versions |
| 75 | + - Labels: dependencies, automated |
| 76 | +
|
| 77 | + ## Step 4: Create separate PR for major updates |
| 78 | + If there are major updates: |
| 79 | + 1. Reset to main branch |
| 80 | + 2. Create branch: deps/major-YYYYMMDD |
| 81 | + 3. Update pyproject.toml files with major version bumps only |
| 82 | + 4. Preserve exact formatting, extras, and markers |
| 83 | + 5. Commit with message: 'chore: update dependencies (major) - BREAKING' |
| 84 | + 6. Push and create PR with: |
| 85 | + - Title: 'chore: update dependencies (major) ⚠️ BREAKING' |
| 86 | + - Body: Table of updated packages with old -> new versions, note that these are major updates requiring manual review |
| 87 | + - Labels: dependencies, automated, breaking |
| 88 | +
|
| 89 | + ## Step 5: Summary |
| 90 | + Print a summary of what was done: |
| 91 | + - Number of patch/minor updates (and PR link if created) |
| 92 | + - Number of major updates (and PR link if created) |
| 93 | + - Any packages that were skipped and why |
| 94 | +
|
| 95 | + If no updates needed, print 'All dependencies are up to date'." --model gpt-4o |
0 commit comments