update_news: Update NEWS.md with messages from top-level commits

View source: R/api-update-news.R

update_newsR Documentation

Update NEWS.md with messages from top-level commits

Description

Lists all commits from a range (default: top-level commits since the most recent tag as determined by get_last_version_tag()) and adds bullets from their body to NEWS.md. Creates NEWS.md if necessary.

Usage

update_news(
  messages = NULL,
  which = c("auto", "samedev", "dev", "pre-patch", "patch", "pre-minor", "minor",
    "pre-major", "major")
)

Arguments

messages

A character vector of commit messages, e.g. as in the message column in the return value of get_top_level_commits(). The default uses the top level commits since the last tag as retrieved by get_last_version_tag().

which

Component of the version number to update. Supported values are

  • "auto" (default: "samedev" or "dev", depending on contents of NEWS.md),

  • "samedev" (a.b.c.900x with stable version),

  • "dev" (a.b.c.9xxx),

  • "patch" (a.b.x),

  • "pre-minor" (a.b.99.9000),

  • "minor" (a.x.0),

  • "pre-major" (a.99.99.9000),

  • "major" (x.0.0).

Value

None

Examples

# Create mock package in a temporary directory.
# Set open to TRUE if you want to play in the mock package.
with_demo_project({
  # Use functions as if inside the newly created package project.
  # (Or go and actually run code inside the newly created package project!)
  # Add a new R file.
  usethis::use_r("cool-function", open = FALSE)
  # Pretend we added useful code inside it.
  # Track the new R file with Git.
  gert::git_add("R/cool-function.R")
  gert::git_commit("- Add cool function.")
  # Bump version with fledge.
  fledge::bump_version()
  fledge::update_news(c("- something I forgot", "- blabla"), which = "patch")
  gert::git_add("NEWS.md")
  gert::git_commit(message = "release notes tweaking")
  fledge::tag_version()
  print(fledge::get_last_version_tag())
})

cynkra/fledge documentation built on April 17, 2025, 3:56 a.m.