Add a ruleset indicating that a status check must pass, or that PRs are required, for the main branch. Then:
gert::git_push()
info <- gert::git_info()
info$commit
#> [1] "0df1ef7c90ef5d4aa939e0d1aea56ab130d50d17"
gert::git_commit_id(info$upstream)
#> [1] "81680ff5d1608d1f64688e29c2852b41351b8fdb"
Created on 2024-08-18 with reprex v2.1.0
In interactive mode (can't reprex), I'm seeing:
d> gert::git_push()
Trying to authenticate 'git' using ssh-agent...
[status] refs/heads/main: push declined due to repository rule violations
I can work around by checking if <remote>/<branch> is the same as the local branch, but it would be better IMO if git_push() did that for me.