Skip to content

Commit bd752be

Browse files
committed
create new PRs every night
1 parent 368cbd9 commit bd752be

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

.github/workflows/dependency-checker.yaml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,22 @@ jobs:
3232
3333
# Check if a PR already exists for the package
3434
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+
4852
done
4953

0 commit comments

Comments
 (0)