The problem seems to be in pr_find(). It correctly returns character() with a new pr to a repo with some pr (e.g. https://github.com/maurolepore/with-some-pr). But errors if the new pr is to a repo with no previous pr.
# Okusethis:::pr_find("maurolepore", repo="with-some-pr", pr_branch="new")
#> character(0)# Failsusethis:::pr_find("maurolepore", repo="with-no-pr", pr_branch="new")
#> Error in prs[]: subscript out of bounds
The is the minimal fix, maybe too terse. A more expressive
solution comes in a separate commit, to allow reverting it if you
prefer the shorter solution.
The tests will also come in a separate commit because they test
the internal `pr_find()` instead of the exported `pr_push()`. You
may want to revert that upcomming commit too.