GRM-28: fix: Vikunja task resolution pagination in post_merge.py
Post-merge Vikunja update / vikunja (push) Failing after 8s
CI / quality (push) Successful in 1m5s
CI / molecule-tests (1) (push) Successful in 6m44s
CI / molecule-tests (2) (push) Successful in 7m7s
CI / molecule-tests (0) (push) Successful in 9m35s

This commit was merged in pull request #7.
This commit is contained in:
2026-06-20 17:48:08 +00:00
parent 0fadb7c504
commit 3364355c73
5 changed files with 76 additions and 34 deletions
+22 -14
View File
@@ -33,21 +33,29 @@ def extract_conventional_msg(commit_msg: str) -> str:
def resolve_task_id(client: VikunjaClient, task_id: str) -> int:
"""Resolve GRM-N identifier to Vikunja numeric task ID."""
tasks = client.list_tasks(per_page=DEFAULT_PER_PAGE)
matches = [
t for t in tasks
if t.get("project_id") == VIKUNJA_PROJECT_ID and t.get("identifier") == task_id
]
if not matches:
raise click.ClickException(
_(
"Could not find Vikunja task for {task_id} in project {project_id}.",
task_id=task_id,
project_id=VIKUNJA_PROJECT_ID,
)
"""Resolve GRM-N identifier to Vikunja numeric task ID.
Paginates through the project's tasks to handle projects with more
than 50 tasks.
"""
page = 1
while True:
tasks = client.list_project_tasks(VIKUNJA_PROJECT_ID, page=page, per_page=DEFAULT_PER_PAGE)
if not tasks:
break
matches = [t for t in tasks if t.get("identifier") == task_id]
if matches:
return int(matches[0]["id"])
if len(tasks) < DEFAULT_PER_PAGE:
break
page += 1
raise click.ClickException(
_(
"Could not find Vikunja task for {task_id} in project {project_id}.",
task_id=task_id,
project_id=VIKUNJA_PROJECT_ID,
)
return int(matches[0]["id"])
)
def build_comment(task_id: str, conv_msg: str, commit_sha: str) -> str: