Compare commits

...

2 Commits

Author SHA1 Message Date
b4b2b2ec5d Merge pull request 'Don't check merge base branch' (#13) from 10-no-recheck-master into master
All checks were successful
test / test (push) Successful in 53s
build / build (push) Successful in 2m22s
Reviewed-on: #13
2024-10-07 14:39:35 +00:00
ec8e3e491e Don't check merge base branch
All checks were successful
test / test (pull_request) Successful in 51s
build / build (pull_request) Successful in 2m9s
2024-10-07 16:32:49 +02: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)