|
| 1 | +name: Bump Dependencies |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run weekly on Monday at 9:00 AM UTC |
| 6 | + - cron: '0 9 * * 1' |
| 7 | + workflow_dispatch: # Allow manual triggering |
| 8 | + |
| 9 | +jobs: |
| 10 | + bump-dependencies: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Checkout repository |
| 14 | + uses: actions/checkout@v3 |
| 15 | + with: |
| 16 | + fetch-depth: 0 |
| 17 | + submodules: true |
| 18 | + |
| 19 | + - name: Set up Python |
| 20 | + uses: actions/setup-python@v4 |
| 21 | + with: |
| 22 | + python-version: '3.10' |
| 23 | + |
| 24 | + - name: Install Poetry |
| 25 | + run: | |
| 26 | + python -m pip install --upgrade pip |
| 27 | + pip install poetry |
| 28 | +
|
| 29 | + - name: Check for outdated packages |
| 30 | + id: check-outdated |
| 31 | + run: | |
| 32 | + poetry show --outdated > outdated.txt || true |
| 33 | + if [ -s outdated.txt ]; then |
| 34 | + echo "has_updates=true" >> $GITHUB_OUTPUT |
| 35 | + echo "Outdated packages found:" |
| 36 | + cat outdated.txt |
| 37 | + else |
| 38 | + echo "has_updates=false" >> $GITHUB_OUTPUT |
| 39 | + echo "No outdated packages found" |
| 40 | + fi |
| 41 | +
|
| 42 | + - name: Update dependencies |
| 43 | + if: steps.check-outdated.outputs.has_updates == 'true' |
| 44 | + run: | |
| 45 | + poetry update |
| 46 | + poetry install |
| 47 | +
|
| 48 | + - name: Run linting |
| 49 | + if: steps.check-outdated.outputs.has_updates == 'true' |
| 50 | + run: | |
| 51 | + poetry run flake8 |
| 52 | +
|
| 53 | + - name: Run tests |
| 54 | + if: steps.check-outdated.outputs.has_updates == 'true' |
| 55 | + run: | |
| 56 | + poetry run pytest -v |
| 57 | +
|
| 58 | + - name: Check for changes |
| 59 | + if: steps.check-outdated.outputs.has_updates == 'true' |
| 60 | + id: check-changes |
| 61 | + run: | |
| 62 | + if git diff --quiet poetry.lock pyproject.toml; then |
| 63 | + echo "has_changes=false" >> $GITHUB_OUTPUT |
| 64 | + else |
| 65 | + echo "has_changes=true" >> $GITHUB_OUTPUT |
| 66 | + fi |
| 67 | +
|
| 68 | + - name: Create Pull Request |
| 69 | + if: steps.check-outdated.outputs.has_updates == 'true' && steps.check-changes.outputs.has_changes == 'true' |
| 70 | + uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 |
| 71 | + with: |
| 72 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 73 | + commit-message: 'LITE-33140: Bulk bump modules' |
| 74 | + branch: LITE-33140-bulk-bump-modules |
| 75 | + delete-branch: true |
| 76 | + title: 'LITE-33140: Bulk bump modules' |
| 77 | + body: | |
| 78 | + ## Automated Dependency Update |
| 79 | + |
| 80 | + This PR was automatically generated by the bump workflow. |
| 81 | + |
| 82 | + ### Changes |
| 83 | + - Updated outdated dependencies to their latest compatible versions |
| 84 | + - All tests passed successfully |
| 85 | + |
| 86 | + ### Outdated Packages |
| 87 | + ``` |
| 88 | + ${{ steps.check-outdated.outputs.outdated }} |
| 89 | + ``` |
| 90 | + |
| 91 | + Please review the changes and merge if everything looks good. |
| 92 | + labels: | |
| 93 | + dependencies |
| 94 | + automated |
0 commit comments