diff --git a/.github/workflows/pdm-lock-automate-build.yaml b/.github/workflows/pdm-lock-automate-build.yaml index 128ab9ad4..5b8b4450f 100644 --- a/.github/workflows/pdm-lock-automate-build.yaml +++ b/.github/workflows/pdm-lock-automate-build.yaml @@ -3,7 +3,8 @@ name: Update PDM Lock Files on: push: paths: - - 'unstract/**/pyproject.toml' + - '**/pyproject.toml' # Watch for changes in any pyproject.toml file + jobs: update-pdm-lock: @@ -11,49 +12,66 @@ jobs: strategy: matrix: - service: [backend, prompt-service, platform-service] + # service: [backend, prompt-service, platform-service] + service: [backend, prompt-service] steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: '3.9.0' + python-version: '3.9' - name: Install PDM run: python -m pip install pdm - - name: Update pdm.lock for ${{ matrix.service }} - run: | - cd unstract/${{ matrix.service }} - pdm venv create -w virtualenv --with-pip - source .venv/bin/activate - pdm lock - - name: Update pdm.lock for root directory + - name: Create virtual environment + run: pdm venv create -w virtualenv --with-pip + + - name: Update pdm.lock for ${{ matrix.service }} run: | - cd unstract + cd ${{ matrix.service }} pdm venv create -w virtualenv --with-pip source .venv/bin/activate pdm lock - - name: Commit changes - run: | git config --global user.name 'github-actions[bot]' git config --global user.email 'github-actions[bot]@users.noreply.github.com' - # Commit changes for each service directory - cd unstract/${{ matrix.service }} git add pdm.lock - git commit -m "Update pdm.lock for ${{ matrix.service }}" - # Commit changes for root directory - cd .. + # Debugging output + echo "Listing matrix dir name:"; pwd + echo "Listing files in matrix directory:"; ls -al | grep pdm.lock + + - name: Update pdm.lock for root + run: | + source .venv/bin/activate + pdm lock + git add pdm.lock - git commit -m "Update pdm.lock for root directory" + + # Debugging output + echo "Listing root dir name:"; pwd + echo "Listing files in root directory:"; ls -al | grep pdm.lock + + - name: Activate virtual environment and install pre-commit + run: | + source .venv/bin/activate + python -m pip install --upgrade pip + pip install pre-commit~=3.6.2 + + - name: Run pre-commit hooks and commit pdm lock changes + run: | + source .venv/bin/activate + git add .pre-commit-config.yaml + pre-commit run + git commit -m "Adding pdm.lock for root directory" - name: Push changes - run: git push + run: | + echo "yes" | git push git@github.com:${{ github.repository }} HEAD:${{ github.ref }} if: success()