diff options
author | James McCoy <jamessan@jamessan.com> | 2021-08-15 11:39:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-15 11:39:08 -0400 |
commit | aa07d06bf44b3931c04bb1db5043c0fbe30548f4 (patch) | |
tree | 6a1622b468b29f0dd76a32fd168970c0da798af6 | |
parent | c6ef95606f43225885a0a7ba06780ededf9f7cab (diff) | |
parent | 9367aee62dc9f8a3e1f1c35f9b85eea3a6bbe113 (diff) | |
download | rneovim-aa07d06bf44b3931c04bb1db5043c0fbe30548f4.tar.gz rneovim-aa07d06bf44b3931c04bb1db5043c0fbe30548f4.tar.bz2 rneovim-aa07d06bf44b3931c04bb1db5043c0fbe30548f4.zip |
Merge pull request #15363 from dundargoc/ci/squash
ci: ensure all PRs are up to date with master before attempting squash
-rw-r--r-- | scripts/squash_typos.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/scripts/squash_typos.py b/scripts/squash_typos.py index 305680f079..26be6010a2 100644 --- a/scripts/squash_typos.py +++ b/scripts/squash_typos.py @@ -39,7 +39,7 @@ def get_authors_and_emails_from_pr(): return sorted(authors_and_emails_unique) -def rebase_onto_pr(): +def rebase_squash_branch_onto_pr(): """ Rebase current branch onto the PR. @@ -49,6 +49,10 @@ def rebase_onto_pr(): # Check out the pull request. 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. 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(): """ @@ -175,7 +191,10 @@ def main(): 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) subprocess.call( |