File tree Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -32,18 +32,22 @@ jobs:
32
32
33
33
# Check if a PR already exists for the package
34
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-${{ github.run_id }}"
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
- sleep 30 # prevent rate limit.
47
- fi
35
+ echo "Pr for $dirpath already exists. Deleting old PR."
36
+ pr_id=$(gh pr list --state open --json id --search "$pr_name" -q '.[0].id')
37
+ gh pr close "$pr_id" --delete-branch
38
+
39
+ fi
40
+
41
+ # Create PR
42
+ branch_name="dependency-updater-$dirpath-${{ github.run_id }}"
43
+ git checkout -b "$branch_name"
44
+ 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
+
48
52
done
49
53
You can’t perform that action at this time.
0 commit comments