Update Dependencies #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Dependencies | |
on: | |
schedule: | |
- cron: '0 0 * * 0' # Runs at 00:00 every Sunday | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
update-dependencies: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PDM | |
uses: pdm-project/setup-pdm@v4 | |
with: | |
cache: true | |
- name: Lock dependencies | |
run: pdm lock | |
- name: Export requirements | |
run: pdm run export | |
- name: Check for changes | |
id: git-check | |
run: | | |
git diff --exit-code --quiet requirements.txt || echo "changed=true" >> $GITHUB_OUTPUT | |
- name: Create Pull Request | |
if: steps.git-check.outputs.changed == 'true' | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git checkout -b update-dependencies-${{ github.run_id }} | |
git add requirements.txt pyproject.toml pdm.lock | |
git commit -m "Update dependencies" | |
git push origin update-dependencies-${{ github.run_id }} | |
gh pr create --title "Update dependencies" --body "This PR updates the project dependencies. Please review the changes and merge if everything looks good." --base ${{ github.ref_name }} --head update-dependencies-${{ github.run_id }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |