feat: ensure push on pr create
All checks were successful
/ tests (pull_request) Successful in 1m16s
/ static-analysis (pull_request) Successful in 1m27s
/ export-trace (pull_request) Successful in 28s
/ tests (push) Successful in 1m16s
/ static-analysis (push) Successful in 1m35s
/ export-trace (push) Successful in 26s
All checks were successful
/ tests (pull_request) Successful in 1m16s
/ static-analysis (pull_request) Successful in 1m27s
/ export-trace (pull_request) Successful in 28s
/ tests (push) Successful in 1m16s
/ static-analysis (push) Successful in 1m35s
/ export-trace (push) Successful in 26s
This commit is contained in:
parent
635e1423d3
commit
fd11d84466
2 changed files with 9 additions and 0 deletions
|
@ -4,6 +4,7 @@ import click
|
||||||
import pydantic
|
import pydantic
|
||||||
|
|
||||||
import frg.forgejo.browser as forgejo_browser
|
import frg.forgejo.browser as forgejo_browser
|
||||||
|
import frg.git as git
|
||||||
from frg.configuration import Config, get_configuration
|
from frg.configuration import Config, get_configuration
|
||||||
from frg.context import GitContext, get_git_context
|
from frg.context import GitContext, get_git_context
|
||||||
|
|
||||||
|
@ -61,6 +62,9 @@ def pr(ctx):
|
||||||
@click.pass_obj
|
@click.pass_obj
|
||||||
def create_pr(ctx, web: bool):
|
def create_pr(ctx, web: bool):
|
||||||
"""Interacts with pull requests."""
|
"""Interacts with pull requests."""
|
||||||
|
|
||||||
|
git.push(branch=ctx.git.current_branch)
|
||||||
|
|
||||||
if web:
|
if web:
|
||||||
forgejo_browser.create_pull_request_via_web(
|
forgejo_browser.create_pull_request_via_web(
|
||||||
head=ctx.git.current_branch,
|
head=ctx.git.current_branch,
|
||||||
|
|
|
@ -27,3 +27,8 @@ def get_current_branch() -> CommandResult:
|
||||||
def get_current_remote_url() -> CommandResult:
|
def get_current_remote_url() -> CommandResult:
|
||||||
"""Returns the remote origin url."""
|
"""Returns the remote origin url."""
|
||||||
return _git(["config", "--get", "remote.origin.url"])
|
return _git(["config", "--get", "remote.origin.url"])
|
||||||
|
|
||||||
|
|
||||||
|
def push(*, branch: str) -> CommandResult:
|
||||||
|
"""Pushes the current local commits to remote."""
|
||||||
|
return _git(["push", "--set-upstream", "origin", branch])
|
||||||
|
|
Loading…
Reference in a new issue