Skip to content

Protected branches #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
krlmlr opened this issue Sep 30, 2020 · 3 comments
Open

Protected branches #58

krlmlr opened this issue Sep 30, 2020 · 3 comments
Labels
feature a feature request or enhancement

Comments

@krlmlr
Copy link
Contributor

krlmlr commented Sep 30, 2020

finalize_version() currently pushes to the main branch. Can we come up with a good workflow to support protected branches, i.e. if we want to disallow pushing things straight to production?

@krlmlr krlmlr added this to the 0.3.0 milestone Jul 25, 2021
@krlmlr
Copy link
Contributor Author

krlmlr commented May 12, 2022

Currently, bump_version() fails for non-main branch:

library(fledge)

with_demo_project(quiet = TRUE, {
  usethis::use_r("bla")
  gert::git_add("R/bla.R")
  gert::git_commit("* Ad cool bla.")
  gert::git_branch_create("bump")
  bump_version()
})
#> Error in `check_main_branch()` at fledge/R/bump-version.R:6:2:
#> ! ✖ Must be on the main branch (main) for running fledge functions.
#> ℹ Currently on branch bump.

Created on 2022-05-12 by the reprex package (v2.0.1)

We also need #31.

@krlmlr krlmlr added the feature a feature request or enhancement label Feb 4, 2023
@krlmlr
Copy link
Contributor Author

krlmlr commented Feb 4, 2023

It's worth finding out if we can create a setting where fledge can run in GHA (and is allowed to push) but the branch is otherwise protected.

@krlmlr krlmlr modified the milestones: 0.3.0, 1.0.0: Done, for now Feb 4, 2023
@krlmlr
Copy link
Contributor Author

krlmlr commented Aug 21, 2024

Added an argument to bump_version() to skip this check.

To avoid race conditions and incomplete NEWS.md files, we need to rethink how fledge operates in the scenario of protected branches. We need to separate the tagging (which can be made an almost atomic operation that is very likely to succeed) from creating NEWS.md, and do the tagging first. The new workflow would be:

Tagging

  • Create a rich tag with the most recent news
    • Thin about already bumping the version in DESCRIPTION
  • Push the tag

Updating NEWS.md (#31 ?)

  • Compare NEWS.md and DESCRIPTION with the tags in the repo
  • Populate NEWS.md and DESCRIPTION from the rich tags (not from the commits)
  • Push to main/create a PR/...

Tweaking NEWS.md

At the user's convenience, manually, via PR.

Sync back tags (optional, #31)

  • Read NEWS.md
  • Update the rich tags where the contents differ through force-pushing (one by one)

API proposal

Names TBD.

  • New function tag_from_history(push = TRUE)
  • New function update_news_from_tag(check_main_branch = TRUE)
  • bump_version() becomes tag_from_history() and update_news_from_tag()

CC @maelle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Development

No branches or pull requests

1 participant