feat: automatically release status:in-progress on close and merge (#56) #57
+1
-3
@@ -14,6 +14,7 @@ Configuration (mcp_config.json):
|
|||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
import functools
|
import functools
|
||||||
import contextlib
|
import contextlib
|
||||||
@@ -48,9 +49,6 @@ mcp = FastMCP("gitea-tools", instructions=(
|
|||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
def extract_linked_issue_numbers(text: str | None, branch_name: str | None = None) -> list[int]:
|
def extract_linked_issue_numbers(text: str | None, branch_name: str | None = None) -> list[int]:
|
||||||
issues = set()
|
issues = set()
|
||||||
if text:
|
if text:
|
||||||
|
|||||||
@@ -1377,8 +1377,10 @@ class TestTrackerHygieneCleanup(unittest.TestCase):
|
|||||||
return [{"name": "status:in-progress", "id": 1}, {"name": "bug", "id": 2}]
|
return [{"name": "status:in-progress", "id": 1}, {"name": "bug", "id": 2}]
|
||||||
if method == "GET" and "issues/1" in url:
|
if method == "GET" and "issues/1" in url:
|
||||||
return {"labels": [{"name": "status:in-progress"}, {"name": "bug"}]}
|
return {"labels": [{"name": "status:in-progress"}, {"name": "bug"}]}
|
||||||
if method == "DELETE" and "labels/1" in url:
|
if method == "DELETE" and url.endswith("/issues/1/labels/1"):
|
||||||
return {}
|
return {}
|
||||||
|
if method == "PUT" and "labels" in url:
|
||||||
|
self.fail("Should not replace the issue label set")
|
||||||
return {}
|
return {}
|
||||||
self.mock_api.side_effect = api_side_effect
|
self.mock_api.side_effect = api_side_effect
|
||||||
|
|
||||||
@@ -1395,8 +1397,10 @@ class TestTrackerHygieneCleanup(unittest.TestCase):
|
|||||||
return [{"name": "status:in-progress", "id": 1}, {"name": "bug", "id": 2}]
|
return [{"name": "status:in-progress", "id": 1}, {"name": "bug", "id": 2}]
|
||||||
if method == "GET" and "issues/1" in url:
|
if method == "GET" and "issues/1" in url:
|
||||||
return {"labels": [{"name": "bug"}]}
|
return {"labels": [{"name": "bug"}]}
|
||||||
if method == "DELETE" and "labels/1" in url:
|
if method == "DELETE" and "labels" in url:
|
||||||
self.fail("Should not DELETE labels")
|
self.fail("Should not DELETE labels")
|
||||||
|
if method == "PUT" and "labels" in url:
|
||||||
|
self.fail("Should not replace the issue label set")
|
||||||
return {}
|
return {}
|
||||||
self.mock_api.side_effect = api_side_effect
|
self.mock_api.side_effect = api_side_effect
|
||||||
|
|
||||||
@@ -1425,8 +1429,10 @@ class TestTrackerHygieneCleanup(unittest.TestCase):
|
|||||||
return [{"name": "status:in-progress", "id": 1}, {"name": "bug", "id": 2}]
|
return [{"name": "status:in-progress", "id": 1}, {"name": "bug", "id": 2}]
|
||||||
if method == "GET" and "issues/123" in url:
|
if method == "GET" and "issues/123" in url:
|
||||||
return {"labels": [{"name": "status:in-progress"}, {"name": "bug"}]}
|
return {"labels": [{"name": "status:in-progress"}, {"name": "bug"}]}
|
||||||
if method == "DELETE" and "labels/1" in url:
|
if method == "DELETE" and url.endswith("/issues/123/labels/1"):
|
||||||
return {}
|
return {}
|
||||||
|
if method == "PUT" and "labels" in url:
|
||||||
|
self.fail("Should not replace the issue label set")
|
||||||
return {}
|
return {}
|
||||||
self.mock_api.side_effect = api_side_effect
|
self.mock_api.side_effect = api_side_effect
|
||||||
|
|
||||||
@@ -1455,8 +1461,10 @@ class TestTrackerHygieneCleanup(unittest.TestCase):
|
|||||||
return [{"name": "status:in-progress", "id": 1}, {"name": "bug", "id": 2}]
|
return [{"name": "status:in-progress", "id": 1}, {"name": "bug", "id": 2}]
|
||||||
if method == "GET" and "issues/123" in url:
|
if method == "GET" and "issues/123" in url:
|
||||||
return {"labels": [{"name": "status:in-progress"}, {"name": "bug"}]}
|
return {"labels": [{"name": "status:in-progress"}, {"name": "bug"}]}
|
||||||
if method == "DELETE" and "labels/1" in url:
|
if method == "DELETE" and url.endswith("/issues/123/labels/1"):
|
||||||
return {}
|
return {}
|
||||||
|
if method == "PUT" and "labels" in url:
|
||||||
|
self.fail("Should not replace the issue label set")
|
||||||
return {}
|
return {}
|
||||||
self.mock_api.side_effect = api_side_effect
|
self.mock_api.side_effect = api_side_effect
|
||||||
|
|
||||||
@@ -1479,8 +1487,10 @@ class TestTrackerHygieneCleanup(unittest.TestCase):
|
|||||||
return [{"name": "status:in-progress", "id": 1}]
|
return [{"name": "status:in-progress", "id": 1}]
|
||||||
if method == "GET" and "issues/123" in url:
|
if method == "GET" and "issues/123" in url:
|
||||||
return {"labels": [{"name": "status:in-progress"}]}
|
return {"labels": [{"name": "status:in-progress"}]}
|
||||||
if method == "DELETE" and "labels/1" in url:
|
if method == "DELETE" and url.endswith("/issues/123/labels/1"):
|
||||||
return {}
|
return {}
|
||||||
|
if method == "PUT" and "labels" in url:
|
||||||
|
self.fail("Should not replace the issue label set")
|
||||||
if method == "POST" and "comments" in url:
|
if method == "POST" and "comments" in url:
|
||||||
return {}
|
return {}
|
||||||
return {}
|
return {}
|
||||||
@@ -1509,8 +1519,12 @@ class TestTrackerHygieneCleanup(unittest.TestCase):
|
|||||||
return {"labels": [{"name": "status:in-progress"}]}
|
return {"labels": [{"name": "status:in-progress"}]}
|
||||||
if method == "GET" and "issues/125" in url:
|
if method == "GET" and "issues/125" in url:
|
||||||
return {"labels": []}
|
return {"labels": []}
|
||||||
if method == "DELETE" and "labels/1" in url:
|
if method == "DELETE" and url.endswith("/issues/123/labels/1"):
|
||||||
return {}
|
return {}
|
||||||
|
if method == "DELETE" and url.endswith("/issues/124/labels/1"):
|
||||||
|
return {}
|
||||||
|
if method == "PUT" and "labels" in url:
|
||||||
|
self.fail("Should not replace the issue label set")
|
||||||
if method == "POST" and "comments" in url:
|
if method == "POST" and "comments" in url:
|
||||||
return {}
|
return {}
|
||||||
return {}
|
return {}
|
||||||
@@ -1548,8 +1562,10 @@ class TestTrackerHygieneCleanup(unittest.TestCase):
|
|||||||
return [{"name": "status:in-progress", "id": 1}]
|
return [{"name": "status:in-progress", "id": 1}]
|
||||||
if method == "GET" and "issues/1" in url:
|
if method == "GET" and "issues/1" in url:
|
||||||
return {"labels": [{"name": "status:in-progress"}]}
|
return {"labels": [{"name": "status:in-progress"}]}
|
||||||
if method == "DELETE" and "labels/1" in url:
|
if method == "DELETE" and url.endswith("/issues/1/labels/1"):
|
||||||
raise RuntimeError("API failure")
|
raise RuntimeError("API failure")
|
||||||
|
if method == "PUT" and "labels" in url:
|
||||||
|
self.fail("Should not replace the issue label set")
|
||||||
return {}
|
return {}
|
||||||
self.mock_api.side_effect = api_side_effect
|
self.mock_api.side_effect = api_side_effect
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user