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 ofgh::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()
:
Determines the staged release title from
NEWS.md
usingget_release()
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()
Verifies the staged pull request is ready to be merged by checking the locked, draft, mergeable, and rebaseable flags
Merges the pull request into the default branch using "Rebase and merge" using
gh::gh()
Deletes the pull request branch remotely and locally using
gh::gh()
andgert::git_branch_delete()
Updates the default branch with
gert::git_pull()
Adds the version tag to the
DESCRIPTION
commit with the message"GitHub release <version>"
withgert::git_tag_create()
and pushes usinggert::git_tag_push()
Create the GitHub release from the newly created tag, with the name
"<version>"
and the release notes in the body, usinggh::gh()