diff --git a/app.py b/app.py index 832dc7a..09b90cf 100644 --- a/app.py +++ b/app.py @@ -47,18 +47,31 @@ def index(): days = request.args.get("days", default=30, type=int) created_priority_bugs = get_created_issues(2, "Bug", days) open_priority_bugs = get_open_issues(2, "Bug") - completed_priority_bugs = get_completed_issues(2, "Bug", days) - completed_bugs = get_completed_issues(5, "Bug", days) - completed_new_features = get_completed_issues( - 5, - "New Feature", - days, - ) - completed_technical_changes = get_completed_issues( - 5, - "Technical Change", - days, - ) + # Only include non-project issues in the index summary + completed_priority_bugs = [ + issue for issue in get_completed_issues(2, "Bug", days) + if not issue.get("project") + ] + completed_bugs = [ + issue for issue in get_completed_issues(5, "Bug", days) + if not issue.get("project") + ] + completed_new_features = [ + issue for issue in get_completed_issues( + 5, + "New Feature", + days, + ) + if not issue.get("project") + ] + completed_technical_changes = [ + issue for issue in get_completed_issues( + 5, + "Technical Change", + days, + ) + if not issue.get("project") + ] open_work = ( get_open_issues(5, "Bug") + get_open_issues(5, "New Feature") diff --git a/jobs.py b/jobs.py index 3798f0e..f97a9a5 100644 --- a/jobs.py +++ b/jobs.py @@ -8,6 +8,7 @@ from dotenv import load_dotenv from config import load_config +from constants import PRIORITY_TO_SCORE from github import ( get_prs_waiting_for_review_by_reviewer, get_prs_with_changes_requested_by_reviewer, @@ -19,7 +20,6 @@ get_stale_issues_by_assignee, ) from openai_client import get_chat_function_call -from constants import PRIORITY_TO_SCORE load_dotenv() @@ -324,6 +324,30 @@ def post_weekly_changelog(): unique.append(issue) issues = unique + # Include only issues without a project or from the configured cycle initiative projects + config = load_config() + cycle_init = config.get("cycle_initiative") + if cycle_init: + projects = get_projects() + cycle_projects = [ + p["name"] + for p in projects + if any( + node.get("name") == cycle_init + for node in p.get("initiatives", {}).get("nodes", []) + ) + ] + issues = [ + issue + for issue in issues + if not issue.get("project") or issue.get("project") in cycle_projects + ] + else: + issues = [issue for issue in issues if not issue.get("project")] + + if not issues: + return + chunks = [] for issue in issues: desc = issue.get("description") or "" diff --git a/linear.py b/linear.py index 57b20ee..814f32f 100644 --- a/linear.py +++ b/linear.py @@ -118,19 +118,21 @@ def get_completed_issues(priority, label, days=30): issues( first: 50 after: $cursor - filter: { + filter: { team: { name: { eq: "Apollos" } } labels: { name: { eq: $label } } priority: { lte: $priority } state: { name: { in: ["Done"] } } - completedAt:{gt: $days} - project: { null: true } + completedAt: { gt: $days } } orderBy: updatedAt ) { nodes { id title + project { + name + } description comments { nodes { @@ -191,6 +193,11 @@ def get_completed_issues(priority, label, days=30): if not data["issues"]["pageInfo"]["hasNextPage"]: break cursor = data["issues"]["pageInfo"]["endCursor"] + + # Normalize project to simple name or None + for issue in issues: + proj = issue.get("project", {}).get("name") if issue.get("project") else None + issue["project"] = proj return issues