|
| 1 | +name: Update Poetry Lock |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - 'pyproject.toml' |
| 7 | + branches: |
| 8 | + - main |
| 9 | + - develop |
| 10 | + |
| 11 | +jobs: |
| 12 | + update-poetry-lock: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout code |
| 17 | + uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 20 | + fetch-depth: 0 |
| 21 | + |
| 22 | + - name: Set up Python |
| 23 | + uses: actions/setup-python@v4 |
| 24 | + with: |
| 25 | + python-version: '3.11' # Adjust to your preferred Python version |
| 26 | + |
| 27 | + - name: Install Poetry |
| 28 | + uses: snok/install-poetry@v1 |
| 29 | + with: |
| 30 | + version: latest |
| 31 | + virtualenvs-create: true |
| 32 | + virtualenvs-in-project: true |
| 33 | + |
| 34 | + - name: Cache Poetry dependencies |
| 35 | + uses: actions/cache@v3 |
| 36 | + with: |
| 37 | + path: .venv |
| 38 | + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} |
| 39 | + |
| 40 | + - name: Update Poetry lock file |
| 41 | + run: poetry update |
| 42 | + |
| 43 | + - name: Check for changes in poetry.lock |
| 44 | + id: verify-changed-files |
| 45 | + run: | |
| 46 | + if [ -n "$(git status --porcelain poetry.lock)" ]; then |
| 47 | + echo "changed=true" >> $GITHUB_OUTPUT |
| 48 | + echo "Poetry lock file was updated" |
| 49 | + else |
| 50 | + echo "changed=false" >> $GITHUB_OUTPUT |
| 51 | + echo "No changes to poetry.lock file" |
| 52 | + fi |
| 53 | +
|
| 54 | + - name: Create Pull Request |
| 55 | + if: steps.verify-changed-files.outputs.changed == 'true' |
| 56 | + uses: peter-evans/create-pull-request@v5 |
| 57 | + with: |
| 58 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + commit-message: "chore: update poetry.lock after pyproject.toml changes" |
| 60 | + title: "🔄 Update poetry.lock file" |
| 61 | + body: | |
| 62 | + ## Poetry Lock Update |
| 63 | + |
| 64 | + This PR was automatically created because `pyproject.toml` was modified. |
| 65 | + |
| 66 | + ### Changes |
| 67 | + - Updated `poetry.lock` file to reflect dependency changes in `pyproject.toml` |
| 68 | + |
| 69 | + ### Notes |
| 70 | + - Please review the dependency changes before merging |
| 71 | + - Run tests to ensure compatibility with updated dependencies |
| 72 | + - Check for any breaking changes in updated packages |
| 73 | + |
| 74 | + --- |
| 75 | + *This PR was created automatically by the Poetry Update workflow* |
| 76 | + branch: chore/update-poetry-lock |
| 77 | + delete-branch: true |
| 78 | + assignees: ${{ github.actor }} |
| 79 | + reviewers: ${{ github.actor }} |
| 80 | + labels: | |
| 81 | + dependencies |
| 82 | + automated |
| 83 | + poetry |
0 commit comments