-
Notifications
You must be signed in to change notification settings - Fork 245
Workflow - Auto update deps #248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| name: Check Dependencies | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 2 * * *' | ||
| workflow_dispatch: {} | ||
|
|
||
| jobs: | ||
| update-dependencies: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| issues: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.VISION_AGENTS_GITHUB_TOKEN }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
| with: | ||
| version: "latest" | ||
|
|
||
| - name: Install Cursor CLI | ||
| run: | | ||
| curl https://cursor.com/install -fsS | bash | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Piping curl output directly to bash is a security anti-pattern and vulnerable to MITM attacks. Additionally, there's no verification that the installation succeeded before proceeding. Replace this with a secure installation method: - curl https://cursor.com/install -fsS | bash
- echo "$HOME/.cursor/bin" >> $GITHUB_PATH
+ # Use a package manager or verify checksum instead of piping to bash
+ # For example, if available via package managers:
+ # sudo apt-get install cursor
+ # Or manually verify the binary before execution
+ curl -fsSL https://cursor.com/install -o /tmp/cursor-install.sh
+ # TODO: Add checksum verification here before executing
+ bash /tmp/cursor-install.sh
+ echo "$HOME/.cursor/bin" >> $GITHUB_PATHAlternatively, check if Cursor provides a published package in standard package managers or a tarball with published checksums.
🤖 Prompt for AI Agents |
||
| echo "$HOME/.cursor/bin" >> $GITHUB_PATH | ||
|
|
||
| - name: Configure git | ||
| run: | | ||
| git config --global user.name "github-actions[bot]" | ||
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Check and update dependencies with Cursor Agent | ||
| env: | ||
| CURSOR_API_KEY: ${{ secrets.CURSOR_API_KEY }} | ||
| GH_TOKEN: ${{ secrets.VISION_AGENTS_GITHUB_TOKEN }} | ||
| run: | | ||
| cursor-agent -p "You are a dependency update bot. Your task is to check for outdated Python dependencies and create PRs to update them. | ||
|
|
||
| ## Step 1: Discover pyproject.toml files | ||
| Find all pyproject.toml files in this repository, excluding .venv directories. | ||
|
|
||
| ## Step 2: Check for outdated dependencies | ||
| For each pyproject.toml, extract dependencies from: | ||
| - [project].dependencies | ||
| - [project].optional-dependencies | ||
| - [dependency-groups] | ||
|
|
||
| Skip packages that are workspace packages (listed in [tool.uv.sources] with workspace = true or path references like vision-agents-*, etc.). | ||
|
|
||
| For each external package, query PyPI (https://pypi.org/pypi/{package}/json) to get the latest version. | ||
|
|
||
| Categorize updates into: | ||
| - PATCH/MINOR: e.g., 1.2.0 -> 1.2.5 or 1.2.0 -> 1.3.0 | ||
| - MAJOR: e.g., 1.2.0 -> 2.0.0 | ||
|
|
||
| ## Step 3: Create PR for patch/minor updates | ||
| If there are patch/minor updates: | ||
| 1. Create branch: deps/patch-minor-YYYYMMDD | ||
| 2. Update pyproject.toml files with patch/minor version bumps only | ||
| 3. Preserve exact formatting, extras, and markers | ||
| 4. Respect override-dependencies in root pyproject.toml | ||
| 5. Commit with message: 'chore: update dependencies (patch/minor)' | ||
| 6. Push and create PR with: | ||
| - Title: 'chore: update dependencies (patch/minor)' | ||
| - Body: Table of updated packages with old -> new versions | ||
| - Labels: dependencies, automated | ||
|
|
||
| ## Step 4: Create separate PR for major updates | ||
| If there are major updates: | ||
| 1. Reset to main branch | ||
| 2. Create branch: deps/major-YYYYMMDD | ||
| 3. Update pyproject.toml files with major version bumps only | ||
| 4. Preserve exact formatting, extras, and markers | ||
| 5. Commit with message: 'chore: update dependencies (major) - BREAKING' | ||
| 6. Push and create PR with: | ||
| - Title: 'chore: update dependencies (major) ⚠️ BREAKING' | ||
| - Body: Table of updated packages with old -> new versions, note that these are major updates requiring manual review | ||
| - Labels: dependencies, automated, breaking | ||
|
|
||
| ## Step 5: Summary | ||
| Print a summary of what was done: | ||
| - Number of patch/minor updates (and PR link if created) | ||
| - Number of major updates (and PR link if created) | ||
| - Any packages that were skipped and why | ||
|
|
||
| If no updates needed, print 'All dependencies are up to date'." --model gpt-4o | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Missing lockfile update after dependency version changesThe workflow prompts
Comment on lines
+42
to
+95
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The workflow offloads all dependency checking, version categorization, and PR creation logic to a natural language prompt sent to cursor-agent. This approach has several systemic risks:
Recommendation: Replace this with a deterministic, auditable approach using established dependency update tools: - - name: Check and update dependencies with Cursor Agent
+ - name: Check and update dependencies
env:
- CURSOR_API_KEY: ${{ secrets.CURSOR_API_KEY }}
GH_TOKEN: ${{ secrets.VISION_AGENTS_GITHUB_TOKEN }}
- run: |
- cursor-agent -p "..." --model gpt-4o
+ uses: dependabot/fetch-metadata@v2
+ # OR use Renovate for more advanced categorization
+ # OR implement a custom Python script with explicit error handlingIf cursor-agent is required, at minimum add:
🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adjust schedule frequency and add human safeguards.
The workflow runs daily at 02:00 UTC. Depending on the repository size and number of dependencies, this could generate many PRs. Without safeguards (e.g., draft PRs, auto-merge restrictions, max PR limits), the workflow could overwhelm reviewers.
Consider:
🤖 Prompt for AI Agents