Skip to contents

Approve a pull request staged with stage_release(), and prepare for release. Merge an approved release with merge_release().

Usage

approve_release(
  pkg = ".",
  filename = "NEWS.md",
  unfreeze = FALSE,
  host = getOption("rdev.host")
)

Arguments

pkg

path to package. Currently, only pkg = "." is supported.

filename

name of file containing release notes, defaults to NEWS.md.

unfreeze

If TRUE, delete the Quarto _freeze directory to fully re-render the site.

host

GitHub host to target, passed to the .api_url argument of gh::gh(). If unspecified, gh defaults to "https://api.github.com", although gh's default can be customised by setting the GITHUB_API_URL environment variable.

For a hypothetical GitHub Enterprise instance, either "https://github.acme.com/api/v3" or "https://github.acme.com" is acceptable.

Value

Staged GitHub pull request, invisibly

Details

When run, approve_release():

  1. Checks for uncommitted changes and stops if any exist using gert::git_status()

  2. Determines the staged release title from NEWS.md using get_release()

  3. Selects the GitHub pull request that matches the staged release title, stops if there is more or less than one matching PR using gh::gh()

  4. Checks if on the PR branch and stops if not (using gert::git_branch())

  5. Verifies the release is not already approved by searching for the release commit

  6. Updates the PR description if the release notes have changed

  7. Updates Version in DESCRIPTION with desc::desc_set_version(), commits and push to git with message "GitHub release <version>" using gert::git_add(), gert::git_commit() and gert::git_push()

  8. Runs build_quarto_site() (if _quarto.yml exists), build_analysis_site() (if pkgdown/_base.yml exists) or build_rdev_site() (if _pkgdown.yml exists), commits and pushes changes (if any) to git with message: "<builder> for release <version>"

Host

Set the rdev.host option when using a GitHub Enterprise server: options(rdev.host = "https://github.example.com/api/v3")