merge_release: Merge staged GitHub release

View source: R/release.R

merge_releaseR Documentation

Merge staged GitHub release

Description

Merge a pull request staged with stage_release() and create a new release on GitHub.

Usage

merge_release(pkg = ".", filename = "NEWS.md", 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.

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.

Details

Manually verify that all status checks have completed before running, as merge_release() doesn't currently validate that status checks are successful.

When run, merge_release():

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

  2. 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()

  3. Verifies the staged pull request is ready to be merged by checking the locked, draft, mergeable, and rebaseable flags

  4. Merges the pull request into the default branch using "Rebase and merge" using gh::gh()

  5. Deletes the pull request branch remotely and locally using gh::gh() and gert::git_branch_delete()

  6. Updates the default branch with gert::git_pull()

  7. Adds the version tag to the DESCRIPTION commit with the message "GitHub release <version>" with gert::git_tag_create() and pushes using gert::git_tag_push()

  8. Create the GitHub release from the newly created tag, with the name "<version>" and the release notes in the body, using gh::gh()

Value

list containing results of pull request merge and GitHub release, invisibly

Host

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


jabenninghoff/rdev documentation built on April 26, 2024, 5:11 a.m.