Skip to content

use_release_issue() changes #1946

Open
Open

Description

@hadley

Based on our discussion at work week, I'd propose that we too new arguments/questions to use_release_issue(): use_pre_release and use_branch.

If use_pre_release is true, then we create two issues a pre-release (the current "prepare for release bullets), and then a release issue, which would gain new bullets for locking the main branch at the start and unlocking at the end.

If use_branch is true, the bullets would replace git pull and git push with (e.g.) pr_init("v1.4.1-release") and merging the PR. (We'd recommend that the PR close the issue automatically with a comment).

(For use_branch = TRUE we still need to think through the post-release process to ensure that both dev and releases sites are updated, and we end up with a dev version on the main branch.)

Activity

  1. hadley commented on Feb 14, 2024

    @hadley
    MemberAuthor

    A couple more thoughts:

    • We probably want to keep use_prerelease = FALSE the default, since it only really affects bigger releases.
    • We might want to make use_branch = TRUE the default, since it's probably good practice for us even we can push directly to main.
    • We might want to move the check runs to the release process, because particularly when using a branch, we can update the version earlier, meaning that we'd move to 0 notes when everything was good.
  2. added
    tidy ✨
    on Feb 15, 2024
  3. added this to the Backlog milestone on Jul 24, 2025
  4. jennybc commented on Sep 5, 2025

    @jennybc
    Member

    We took an initial step on this by adding github_(un)lock_branch() but then I had to revert those changes. Due to the API design, it's going to be pretty fiddly to lock/unlock a branch, without nuking all pre-existing branch protections or leaving it with new, undesired branch protections. I didn't want to put the half-baked version in a patch release and I don't want to do the job right at this time. I'll leave some notes below for our next attempt.


    Thought dump:

    • You lock a branch with the Update branch protection endpoint. Unfortunately you can't only send lock_branch = TRUE. There are other required parameters: required_status_checks, enforce_admins, required_pull_request_reviews, and restrictions, most of which can be either null (disabled) or some more complicated object.
    • We actually do need to set enforce_admins = TRUE when we lock a branch, so that the lock actually has teeth, i.e. even folks with admin permissions can't ignore the lock.
    • However the other 3 seem unrelated to branch locking/unlocking and it would be nice to not change their configuration.
    • If you try to GET the current protections for a branch, when there are none, you get a 404, not an empty list or anything like that. So you need to tryCatch() it. The relevant endpoint is Get branch protection.
    • The response schema when you GET branch protections is not the same schema as what you need to send with the PUT to modify branch protections. So it's not easy to leave other protections alone, while we fiddle with lock_branch and enforce_admins.

    Lived experience:

    • While fiddling with Lock and unlock branch as part of the release process #2145 I locked / unlocked the PR branch itself a few times. That seemed to be working. And yet pr_finish() failed because it could no longer delete the PR branch. Some of the branch protections we'd put in place during the process lingered on.
    • Then you are tempted to bring out the big hammer and use the Delete branch protection endpoint, to make the branch delete-able.
    • But what if someone had set branch protections intentionally? It feels uncool for us to delete them with a function that only advertises branch (un)locking.

    I'm sure we can create the functionality we want, but it's going to require more research/time.

  5. jennybc commented on Sep 5, 2025

    @jennybc
    Member

    Parting thought: we might make locking/unlocking easier for ourselves by sending folks to a specific URL with certain boxes pre-checked: https://github.com/r-lib/usethis/settings/branch_protection_rules/new. Similar to how create_github_token() works. Basically, just help folks use the web UI. Would require some research and experimentation to see if this is feasible.

  6. hadley commented on May 18, 2026

    @hadley
    MemberAuthor

    Claude suggests we might be able to use (new-since-last-time-we-tried-this?) rulesets API

    gh("POST /repos/{owner}/{repo}/rulesets",
       owner = "tidyverse",
       repo = "purrr",
       name = "Freeze main",
       target = "branch",
       enforcement = "active",
       conditions = list(
         ref_name = list(include = list("refs/heads/main"), exclude = list())
       ),
       rules = list(
         list(type = "deletion"),
         list(type = "non_fast_forward"),
         list(type = "update")  # blocks all updates = read-only
       )
    )```
    
    And
    
    > Rulesets are nicer for temporary freezes because you can flip enforcement between "active", "evaluate", and "disabled" without deleting and recreating, and you get an explicit ID to manage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    release 🛫tidy ✨

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions