fix: Resolve label assignment issue using dedicated Gitea API endpoint
- Update ProjectManager.set_issue_state() to use /issues/{id}/labels endpoint with PUT method
- Update ProjectManager.set_issue_priority() to use dedicated labels endpoint
- Update IssueWriter.update_labels() to use dedicated labels endpoint for reliability
- Fix API format incompatibility where issue PATCH endpoint was ignoring label updates
- Label assignment now works correctly with proper state and priority management
- Issues will now properly appear in correct Kanban columns based on status labels
Root cause: Gitea API issue PATCH endpoint silently ignores label updates, but the
dedicated labels endpoint (/issues/{id}/labels) with PUT method works correctly.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -251,7 +251,10 @@ class ProjectManager:
|
||||
|
||||
def set_issue_state(self, issue_number: int, state: ProjectState) -> Dict[str, Any]:
|
||||
"""Set issue project state using labels."""
|
||||
# First remove any existing state labels
|
||||
# Use the dedicated labels endpoint which works more reliably
|
||||
labels_url = f"{self.config.issues_api_url}/{issue_number}/labels"
|
||||
|
||||
# First get current labels
|
||||
issue_url = f"{self.config.issues_api_url}/{issue_number}"
|
||||
issue_data = self._make_api_call('GET', issue_url)
|
||||
|
||||
@@ -266,12 +269,16 @@ class ProjectManager:
|
||||
# Add new state label
|
||||
current_labels.append(state.value)
|
||||
|
||||
# Update issue with new labels
|
||||
# Use PUT to replace all labels on the dedicated labels endpoint
|
||||
data = {'labels': current_labels}
|
||||
return self._make_api_call('PATCH', issue_url, data)
|
||||
return self._make_api_call('PUT', labels_url, data)
|
||||
|
||||
def set_issue_priority(self, issue_number: int, priority: Priority) -> Dict[str, Any]:
|
||||
"""Set issue priority using labels."""
|
||||
# Use the dedicated labels endpoint which works more reliably
|
||||
labels_url = f"{self.config.issues_api_url}/{issue_number}/labels"
|
||||
|
||||
# First get current labels
|
||||
issue_url = f"{self.config.issues_api_url}/{issue_number}"
|
||||
issue_data = self._make_api_call('GET', issue_url)
|
||||
|
||||
@@ -286,9 +293,9 @@ class ProjectManager:
|
||||
# Add new priority label
|
||||
current_labels.append(priority.value)
|
||||
|
||||
# Update issue with new labels
|
||||
# Use PUT to replace all labels on the dedicated labels endpoint
|
||||
data = {'labels': current_labels}
|
||||
return self._make_api_call('PATCH', issue_url, data)
|
||||
return self._make_api_call('PUT', labels_url, data)
|
||||
|
||||
def move_issue_to_done(self, issue_number: int) -> Dict[str, Any]:
|
||||
"""Move issue to done state and close it."""
|
||||
|
||||
Reference in New Issue
Block a user