Skip to content

Commit 61897e6

Browse files
adds dependency update workflow
1 parent 6316d4c commit 61897e6

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Dependency-Updater
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
dependency_updater:
10+
name: Dependency-Updater
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
- name: Install Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.8"
19+
- name: Poetry Python dependeny updater
20+
env:
21+
GH_TOKEN: ${{ github.token }}
22+
run: |
23+
git config --global user.name "SDK Releaser Bot"
24+
git config --global user.email "[email protected]"
25+
26+
pip install poetry
27+
make update-dependencies
28+
for file in $(git diff --name-only | grep poetry.lock); do
29+
# Extract the service for which the dependencies have been updated
30+
dirpath=$(dirname $file)
31+
pr_name=$(echo "Dependency Updater: ${dirpath}")
32+
33+
# Check if a PR already exists for the package
34+
if gh pr list --state open | grep -q "${pr_name}"; then
35+
echo "Pr for $dirpath already exists. Skipping."
36+
else
37+
# Create PR
38+
branch_name="dependency-updater-$dirpath"
39+
git checkout -b "$branch_name"
40+
git add "$file"
41+
git commit -m "chore: dependency update"
42+
git push --set-upstream origin "$branch_name"
43+
echo $(git status)
44+
gh pr create --title "$pr_name" --body "Automated dependency update" --base "main"
45+
git checkout main
46+
fi
47+
done
48+

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ update-dependencies:
3030
# lock core
3131
cd core && poetry lock
3232
# lock services
33-
@for f in $(shell ls ${SERVICES_DIR}); do set -e; cd ${SERVICES_DIR}/$${f};poetry lock; cd ../..; done
33+
@for f in $(shell ls ${SERVICES_DIR}); do set -e; cd ${SERVICES_DIR}/$${f};poetry lock; cd ../..; done

0 commit comments

Comments
 (0)