mirror of
https://github.com/neovim/neovim.git
synced 2025-11-17 15:51:32 +00:00
ci: ensure all PRs are up to date with master before attempting squash
This is to ensure unrelated authors don't get credited.
This commit is contained in:
@@ -39,7 +39,7 @@ def get_authors_and_emails_from_pr():
|
|||||||
return sorted(authors_and_emails_unique)
|
return sorted(authors_and_emails_unique)
|
||||||
|
|
||||||
|
|
||||||
def rebase_onto_pr():
|
def rebase_squash_branch_onto_pr():
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Rebase current branch onto the PR.
|
Rebase current branch onto the PR.
|
||||||
@@ -49,6 +49,10 @@ def rebase_onto_pr():
|
|||||||
# Check out the pull request.
|
# Check out the pull request.
|
||||||
subprocess.call(["gh", "pr", "checkout", os.environ["PR_NUMBER"]])
|
subprocess.call(["gh", "pr", "checkout", os.environ["PR_NUMBER"]])
|
||||||
|
|
||||||
|
# Rebase onto master
|
||||||
|
default_branch = f"{os.environ['GITHUB_BASE_REF']}"
|
||||||
|
subprocess.check_call(["git", "rebase", default_branch])
|
||||||
|
|
||||||
# Change back to the original branch.
|
# Change back to the original branch.
|
||||||
subprocess.call(["git", "switch", "-"])
|
subprocess.call(["git", "switch", "-"])
|
||||||
|
|
||||||
@@ -83,6 +87,18 @@ def rebase_onto_pr():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def rebase_squash_branch_onto_master():
|
||||||
|
"""
|
||||||
|
|
||||||
|
Rebase current branch onto the master i.e. make sure current branch is up
|
||||||
|
to date. Abort on error.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
default_branch = f"{os.environ['GITHUB_BASE_REF']}"
|
||||||
|
subprocess.check_call(["git", "rebase", default_branch])
|
||||||
|
|
||||||
|
|
||||||
def squash_all_commits():
|
def squash_all_commits():
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -175,7 +191,10 @@ def main():
|
|||||||
|
|
||||||
squash_branch_exists = checkout_branch(squash_branch)
|
squash_branch_exists = checkout_branch(squash_branch)
|
||||||
|
|
||||||
rebase_onto_pr()
|
rebase_squash_branch_onto_master()
|
||||||
|
force_push(squash_branch)
|
||||||
|
|
||||||
|
rebase_squash_branch_onto_pr()
|
||||||
force_push(squash_branch)
|
force_push(squash_branch)
|
||||||
|
|
||||||
subprocess.call(
|
subprocess.call(
|
||||||
|
|||||||
Reference in New Issue
Block a user