Skip to content

use_github_release() fails uninformatively when there are no lines in NEWS.md section #1048

@petrbouchal

Description

@petrbouchal

Brief description of the problem

When no lines exist in the latest section of NEWS.md, use_github_release() returns Error in text[[1]] : subscript out of bounds.

Reprex:

NEWS.md:

# pkg 0.2.0

# pkg 0.1.0

* news line

Code run:

use_github_release

The error occurs in news_latest() where code removing blank lines errors on an empty string.

This probably typically occurs because the user has taken usethis steps out of sequence, so the most sensible solution would be to stop with an informative error and advise the user to document the release in NEWS.md. Alternatively the function could pass the resulting newline and issue a warning advising the user to document their release when submitting the form on Github.

Happy to try a PR if you can indicate which solution you prefer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorrelease 🛫

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions