Skip to content

Commit a4b67a0

Browse files
committed
fix issue pull
1 parent 02357a4 commit a4b67a0

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

src/release_tool/github_utils.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -418,12 +418,16 @@ def fetch_all_issues(
418418
repo = self.gh.get_repo(repo_full_name)
419419

420420
# Use Core API with explicit pagination
421-
issues_paginated = repo.get_issues(
422-
state='all',
423-
since=since,
424-
sort='created',
425-
direction='asc'
426-
)
421+
# Build kwargs conditionally - PyGithub doesn't accept since=None
422+
kwargs = {
423+
'state': 'all',
424+
'sort': 'created',
425+
'direction': 'asc'
426+
}
427+
if since is not None:
428+
kwargs['since'] = since
429+
430+
issues_paginated = repo.get_issues(**kwargs)
427431

428432
issues = []
429433
page_num = 0
@@ -455,22 +459,23 @@ def fetch_all_issues(
455459

456460
# Convert issues to Issue objects directly
457461
convert_start = time.time()
458-
for idx, issue in enumerate(page):
462+
for idx, gh_item in enumerate(page):
459463
# Skip PRs - GitHub's /issues endpoint returns both issues and PRs
460-
# PRs have a pull_request field that is not None
461-
if issue.pull_request is not None:
464+
# Check raw_data to avoid lazy loading
465+
raw = getattr(gh_item, '_rawData', None) or getattr(gh_item, 'raw_data', {})
466+
if raw.get('pull_request') is not None:
462467
continue
463468

464469
item_start = time.time()
465470
# Convert to Issue using helper (doesn't trigger extra API calls)
466-
issue = self._issue_to_issue(issue, repo_id)
467-
issues.append(issue)
471+
issue_obj = self._issue_to_issue(gh_item, repo_id)
472+
issues.append(issue_obj)
468473
item_time = time.time() - item_start
469474

470475
# Update every 10 items to show progress
471-
if (idx + 1) % 10 == 0:
472-
avg_time = (time.time() - convert_start) / (idx + 1)
473-
progress.update(task, description=f"Fetching issues... page {page_num + 1} (converting {idx + 1}/{len(page)}... {avg_time*1000:.0f}ms/item)")
476+
if len(issues) % 10 == 0:
477+
avg_time = (time.time() - convert_start) / len(issues)
478+
progress.update(task, description=f"Fetching issues... page {page_num + 1} (converting {len(issues)} issues... {avg_time*1000:.0f}ms/item)")
474479

475480
convert_time = time.time() - convert_start
476481
page_num += 1

src/release_tool/pull_manager.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,12 @@ def _fetch_issues_streaming(
522522
return new_issues
523523

524524
except Exception as e:
525+
import traceback
525526
console.print(f"[red]Error fetching issues: {e}[/red]")
526-
return []
527+
console.print(f"[red]Traceback:[/red]")
528+
traceback.print_exc()
529+
import sys
530+
sys.exit(1)
527531

528532
def _fetch_prs_streaming(
529533
self,

0 commit comments

Comments
 (0)