dependencies.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. name: Dependency Updates
  2. on:
  3. schedule:
  4. # Run every Monday at 9:00 AM UTC
  5. - cron: '0 9 * * 1'
  6. workflow_dispatch:
  7. permissions:
  8. contents: write
  9. pull-requests: write
  10. jobs:
  11. update-dependencies:
  12. name: Update Dependencies
  13. runs-on: ubuntu-latest
  14. timeout-minutes: 15
  15. steps:
  16. - name: Checkout repository
  17. uses: actions/checkout@v4
  18. with:
  19. token: ${{ secrets.GITHUB_TOKEN }}
  20. - name: Set up Python
  21. uses: actions/setup-python@v5
  22. with:
  23. python-version: "3.11"
  24. cache: 'pip'
  25. - name: Install pip-tools
  26. run: |
  27. python -m pip install --upgrade pip
  28. pip install pip-tools
  29. - name: Update dependencies
  30. run: |
  31. # Backup current requirements
  32. cp requirements.txt requirements.txt.bak
  33. # Update requirements
  34. pip-compile --upgrade requirements.in || pip-compile --upgrade --generate-hashes requirements.txt
  35. # Check if there are changes
  36. if ! diff -q requirements.txt requirements.txt.bak > /dev/null; then
  37. echo "dependencies_updated=true" >> $GITHUB_ENV
  38. else
  39. echo "dependencies_updated=false" >> $GITHUB_ENV
  40. fi
  41. - name: Test updated dependencies
  42. if: env.dependencies_updated == 'true'
  43. run: |
  44. # Install updated dependencies
  45. pip install -r requirements.txt
  46. # Run basic tests to ensure nothing is broken
  47. python -c "
  48. import sys
  49. import os
  50. sys.path.insert(0, os.getcwd())
  51. try:
  52. from app import app
  53. from database.database import get_engine, create_dynamic_tables
  54. print('✅ Basic imports successful')
  55. except Exception as e:
  56. print(f'❌ Import error: {e}')
  57. sys.exit(1)
  58. "
  59. # Run linting
  60. pip install ruff
  61. ruff check . || echo "⚠️ Linting issues found"
  62. - name: Create Pull Request
  63. if: env.dependencies_updated == 'true'
  64. uses: peter-evans/create-pull-request@v5
  65. with:
  66. token: ${{ secrets.GITHUB_TOKEN }}
  67. commit-message: "chore: update dependencies"
  68. title: "chore: Update dependencies"
  69. body: |
  70. ## Dependency Updates
  71. This PR updates the project dependencies to their latest versions.
  72. ### Changes
  73. - Updated all dependencies in `requirements.txt`
  74. - Basic import tests passed
  75. - Linting checked
  76. ### Testing
  77. - [ ] Manual testing of key features
  78. - [ ] Performance impact evaluation
  79. - [ ] Security review of new versions
  80. ### Notes
  81. Please review the changes and test thoroughly before merging.
  82. ---
  83. *This PR was created automatically by the dependency update workflow.*
  84. branch: dependency-updates
  85. delete-branch: true
  86. labels: dependencies,automated