@@ -2,8 +2,7 @@ name: Weekly Poetry Update
2
2
3
3
on :
4
4
schedule :
5
- # - cron: '0 0 * * 0' # Runs every Sunday at midnight
6
- - cron : ' 0 * * * *' # Runs every hour
5
+ - cron : ' 0 0 * * 0' # Runs every Sunday at midnight
7
6
8
7
jobs :
9
8
update-dependencies :
@@ -26,37 +25,49 @@ jobs:
26
25
curl -sSL https://install.python-poetry.org | python3 -
27
26
export PATH="$HOME/.local/bin:$PATH"
28
27
28
+ - name : Create new branch
29
+ run : |
30
+ git config --global user.name 'github-actions[bot]'
31
+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
32
+ git checkout -b update-dependencies-$(date +%Y%m%d)
33
+
29
34
- name : Install dependencies
30
35
run : poetry install
31
36
32
37
- name : Update dependencies
33
38
run : poetry update | tee poetry-update.log
34
39
35
- - name : Create new branch
40
+ - name : Commit changes
36
41
run : |
37
- git config --global user.name 'github-actions[bot]'
38
- git config --global user.email 'github-actions[bot]@users.noreply.github.com'
39
- git checkout -b update-dependencies-$(date +%Y%m%d)
40
42
git add poetry.lock
41
43
if git diff-index --quiet HEAD; then
42
44
echo "No changes detected, creating an empty commit."
43
45
git commit --allow-empty -m "chore(deps): :arrows_counterclockwise: no updates for $(date +%Y%m%d)"
44
46
else
45
- echo "Changes detected, creating a commit with poetry-update log."
46
- update_log=$(cat poetry-update.log)
47
+ echo "Changes detected, creating a commit with update log."
48
+ if [ -f poetry-update.log ]; then
49
+ update_log=$(cat poetry-update.log)
50
+ else
51
+ update_log="No update log available."
52
+ fi
47
53
git commit -m "$(echo -e "chore(deps): :arrows_counterclockwise: update dependencies $(date +%Y%m%d)\n\n$update_log")"
48
54
fi
49
55
56
+ - name : Push changes
57
+ run : |
58
+ git push -f origin update-dependencies-$(date +%Y%m%d)
59
+
50
60
- name : Create Pull Request via gh
51
- run : >-
52
- gh pr create --title "chore(deps): :arrows_counterclockwise: update dependencies $(date +%Y%m%d)"
53
- --body "This is an auto-generated pull request to update dependencies in poetry.lock."
54
- --base main
61
+ run : |
62
+ gh pr create --title "chore(deps): :arrows_counterclockwise: update dependencies $(date +%Y%m%d)" \
63
+ --body "This is an auto-generated pull request to update dependencies in poetry.lock." \
64
+ --base main \
55
65
--head update-dependencies-$(date +%Y%m%d)
56
66
env :
57
- GITHUB_TOKEN : ${{ secrets.auto_changelog }}
67
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
68
+
58
69
- name : Set Auto PR
59
70
run : |
60
71
gh pr merge update-dependencies-$(date +%Y%m%d) --auto --rebase
61
72
env :
62
- GITHUB_TOKEN : ${{ secrets.auto_changelog }}
73
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments