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