1+ name : Update dependencies
2+
3+ on :
4+ pull_request :
5+
6+ jobs :
7+ update-dependencies :
8+ name : Update dependencies
9+ runs-on : ubuntu-latest
10+
11+ permissions :
12+ contents : write
13+ pull-requests : write
14+
15+ steps :
16+ - name : Checkout repository
17+ uses : actions/checkout@v4
18+
19+ - name : Install uv
20+ uses : astral-sh/setup-uv@v5
21+
22+ - name : Set up Python
23+ uses : actions/setup-python@v2
24+ with :
25+ python-version : " 3.11"
26+
27+ - name : Set up poetry
28+ run : uv pip install poetry --system
29+
30+ - name : Update dependencies
31+ id : update
32+ run : |
33+ # Run the update command
34+ make update
35+
36+ # Check if there are changes
37+ if [[ -z $(git status --porcelain) ]]; then
38+ echo "No changes detected"
39+ echo "changes_detected=false" >> $GITHUB_OUTPUT
40+ else
41+ echo "Changes detected"
42+ echo "changes_detected=true" >> $GITHUB_OUTPUT
43+ fi
44+
45+ - name : Run tests
46+ if : steps.update.outputs.changes_detected == 'true'
47+ run : |
48+ # Add your test command here
49+ make test
50+ # or: pytest
51+ # or: uv run pytest
52+
53+ - name : Create pull request
54+ if : steps.update.outputs.changes_detected == 'true'
55+ run : |
56+ # Configure git
57+ git config --global user.name "github-actions[bot]"
58+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
59+
60+ # Create and push branch
61+ git checkout -b update-dependencies
62+ git add .
63+ git commit -m "Update dependencies"
64+ git push origin update-dependencies --force
65+
66+ # Create or update PR
67+ if gh pr view update-dependencies --json number > /dev/null 2>&1; then
68+ echo "PR already exists, updating..."
69+ gh pr edit update-dependencies --body "Automated dependency updates
70+
71+ This PR was automatically created by the dependency update workflow.
72+
73+ Last updated : $(date)"
74+ else
75+ echo "Creating new PR..."
76+ gh pr create \
77+ --title "Update dependencies" \
78+ --body "Automated dependency updates
79+
80+ This PR was automatically created by the dependency update workflow." \
81+ --base main \
82+ --head update-dependencies
83+ fi
84+ env :
85+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments