@@ -24,30 +24,28 @@ jobs:
2424 git config --global user.email "noreply@stackit.de"
2525
2626 pip install poetry
27+
28+ pr_name=$(echo "Dependency Update")
29+
2730 make update-dependencies
31+ branch_name="dependency-updater-${{ github.run_id }}"
32+ git checkout -b "$branch_name"
2833 for file in $(git diff --name-only | grep poetry.lock); do
2934 # 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. Deleting old PR."
36- pr_number=$(gh pr list --state open --json number --search "$pr_name" -q '.[0].number')
37- gh pr close "$pr_number" --delete-branch
35+ dirpath=$(dirname $file)
3836
39- fi
40-
4137 # Create PR
42- branch_name="dependency-updater-$dirpath-${{ github.run_id }}"
43- git checkout -b "$branch_name"
4438 git add "$file"
45- git commit -m "chore: dependency update"
46- git push --set-upstream origin "$branch_name"
47- echo $(git status)
48- gh pr create --title "$pr_name" --body "Automated dependency update" --base "main"
49- git checkout main
50- sleep 30 # prevent rate limit.
51-
39+ git commit -m "chore: dependency update"
5240 done
41+
42+ # Check if a PR already exists for the package
43+ if gh pr list --state open | grep -q "${pr_name}"; then
44+ echo "Pr for $dirpath already exists. Deleting old PR."
45+ pr_number=$(gh pr list --state open --json number --search "$pr_name" -q '.[0].number')
46+ gh pr close "$pr_number" --delete-branch
47+ fi
48+
49+ git push --set-upstream origin "$branch_name"
50+ gh pr create --title "$pr_name" --body "Automated dependency update" --base "main"
5351
0 commit comments