Don't check merge base branch #13

Merged
torjus merged 1 commits from 10-no-recheck-master into master 2024-10-07 14:39:37 +00:00
3 changed files with 21 additions and 1 deletions

View File

@ -58,6 +58,13 @@ def pr_merge_status(
results = {}
# Check if base branch is in our list, if it is
# no need to call commit_in_branch
merge_base_branch = pr_data.get("base", {}).get("ref")
if merge_base_branch in branches:
results[merge_base_branch] = True
branches.remove(merge_base_branch)
for branch in branches:
in_branch = commit_in_branch(commit_sha, branch)
results[branch] = in_branch

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "nixprstatus"
version = "0.1.2"
version = "0.1.3"
description = "Nixpkgs PR status checker"
authors = ["Torjus Håkestad <torjus@usit.uio.no>"]
license = "MIT"

View File

@ -66,6 +66,19 @@ class TestPRMergeStatus(unittest.TestCase):
res = pr_merge_status(pr, branches, check_backport=True)
self.assertEqual(res.title, expected_title)
@unittest.mock.patch("requests.get", side_effect=mocked_requests_get)
def test_pr_merge_status_no_check_master_345583(self, mock_get):
pr = 345583
branches = ["master", "nixos-unstable", "nixos-24.05"]
master_compare_url = "https://api.github.com/repos/NixOS/nixpkgs/compare/master...2c5fac3edf2d00d948253e392ec1604b29b38f14"
res = pr_merge_status(pr, branches, check_backport=False)
self.assertTrue(res.merged)
self.assertTrue(res.branches["master"])
urls_called = [call[0][0] for call in mock_get.call_args_list]
self.assertFalse(master_compare_url in urls_called)
class TestCommitInBranch(unittest.TestCase):
@unittest.mock.patch("requests.get", side_effect=mocked_requests_get)