merge_release: Merge staged GitHub release

View source: R/release.R

merge_releaseR Documentation

Merge staged GitHub release


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


merge_release(pkg = ".", filename = "", host = getOption(""))



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


name of file containing release notes, defaults to


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

For a hypothetical GitHub Enterprise instance, either "" or "" is acceptable.


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


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


Set the option when using a GitHub Enterprise server: options( = "")

jabenninghoff/rdev documentation built on July 11, 2024, 8:21 p.m.