ropensci-review-tools / roreviewapi

API endpoint for package reviews via ropensci-review-bot
https://docs.ropensci.org/roreviewapi
4 stars 1 forks source link

Dump error message in issue when check fails #11

Closed mpadge closed 3 years ago

mpadge commented 3 years ago

As suggested by @noamross

mpadge commented 3 years ago

Address this by:

  1. Wrap main pkgcheck::pkgchedk() within tryCatch() (because main fn is already called via callr::r_bg(), and that avoids nesting another callr process)
  2. When that errors, dump appropriate error message into issue; then
  3. Check ~/.config/gh/hosts.yml as configured by gh cli to assert that user is ropensci-review-bot, and if so, use gh cli to open new issue in ropensci-review-tools/pkgcheck with info on failed package.
mpadge commented 3 years ago

Update to step 3, because the gh cli is used without a login, so there are no corresponding .config entries. This can be uesd instead:

curl -u <token>:x-oauth-basic https://api.github.com/user

That will then return the corresponding user name, so step 3 can proceed only if that matches ropensci-review-bot