Add GitHub PR diff context to changelog#94
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the weekly changelog generation by incorporating GitHub PR diff content to provide more detailed summaries. The change allows the system to fetch PR diffs for issues with linked GitHub PRs and include this diff information as additional context when generating OpenAI summaries.
Key changes:
- Added GitHub REST API integration to fetch PR diffs
- Enhanced changelog issue processing to extract and include PR diff content
- Updated OpenAI prompt instructions to utilize diff context for better summaries
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| github.py | Added get_pr_diff function and REST API configuration for fetching PR diffs |
| jobs.py | Added _get_pr_diffs helper function and integrated diff content into changelog chunks |
Comments suppressed due to low confidence (1)
github.py:27
- The GitHub API version '2022-11-28' appears to be outdated. Consider using a more recent stable version like '2022-11-28' was the latest stable version as of my knowledge cutoff, but newer versions may be available.
"X-GitHub-Api-Version": "2022-11-28",
| try: | ||
| diff = get_pr_diff(owner, repo, int(number)) | ||
| diffs.append(diff) | ||
| except Exception as e: # pragma: no cover - network errors are ignored |
There was a problem hiding this comment.
Catching a broad Exception is too generic. Consider catching more specific exceptions like requests.RequestException or requests.HTTPError to handle network-related errors more precisely.
| except Exception as e: # pragma: no cover - network errors are ignored | |
| except requests.RequestException as e: # pragma: no cover - network errors are ignored |
| f"Comments: {comments}", | ||
| ] | ||
| if diffs: | ||
| chunk_parts.append("Diff:\n" + "\n".join(diffs)) |
There was a problem hiding this comment.
Multiple string concatenations could be inefficient for large diffs. Consider using a single join operation: chunk_parts.append(f"Diff:\n{chr(10).join(diffs)}")
| chunk_parts.append("Diff:\n" + "\n".join(diffs)) | |
| chunk_parts.append(f"Diff:\n{chr(10).join(diffs)}") |
Summary
get_pr_diffhelperpost_weekly_changelogTesting
flake8 github.py jobs.py linear/*.pypython -m py_compile github.py jobs.py linear/*.py openai_client.py config.pyhttps://chatgpt.com/codex/tasks/task_e_688bc5cc0f608324b13311dcccc98198