Skip to content

Add function to fetch PR contributed repositories - #414

Open
RajShree1854 wants to merge 1 commit into
interviewstreet:mainfrom
RajShree1854:main
Open

Add function to fetch PR contributed repositories#414
RajShree1854 wants to merge 1 commit into
interviewstreet:mainfrom
RajShree1854:main

Conversation

@RajShree1854

Copy link
Copy Markdown
  • Add fetch_pr_contributed_repos to discover repositories with merged external PRs
  • Integrate external PR detection into fetch_all_github_repos
  • Fix filtering of open-source projects when direct author commits are 0, including squashed PR contributions
  • Force-pin top 3 open-source repositories to LLM context for accurate contribution scoring

- Add fetch_pr_contributed_repos to discover repositories with merged external PRs
- Integrate external PR detection into fetch_all_github_repos
- Fix filtering of open-source projects when direct author commits are 0, including squashed PR contributions
- Force-pin top 3 open-source repositories to LLM context for accurate contribution scoring
Copilot AI lite review requested due to automatic review settings August 23, 2026 17:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request enhances GitHub repository discovery and selection by incorporating repositories where a user contributed via merged pull requests (including cases where commit attribution is missing due to squash/merge behavior), and by ensuring open-source projects are surfaced in the final LLM-facing project list.

Changes:

  • Added fetch_pr_contributed_repos() to discover external repositories where the user has merged PRs and include them in the repository set.
  • Integrated PR-contributed repositories into fetch_all_github_repos() and adjusted filtering so open-source projects aren’t dropped when author_commit_count == 0.
  • Updated project selection output to always pin the top 3 open-source repositories (by stars) into the final set returned for LLM context/output.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread github.py
Comment on lines +358 to +361
owned_names = {p["name"] for p in projects}
for contrib in fetch_pr_contributed_repos(username):
if contrib.get("name") not in owned_names:
projects.append(contrib)
Comment thread github.py
Comment on lines +219 to +240
github_token = os.environ.get("GITHUB_TOKEN")
headers = {}
if github_token:
headers["Authorization"] = f"token {github_token}"

try:
resp = requests.get(
"https://api.github.com/search/issues",
params={"q": f"author:{username} type:pr is:merged", "per_page": 100},
headers=headers,
timeout=15,
)
except Exception as e:
logger.error(f"PR search API failed for {username}: {e}")
return []

if resp.status_code != 200:
logger.warning(f"PR search API returned {resp.status_code} for {username}")
return []

external_repos: Dict[str, None] = {}
for item in resp.json().get("items", []):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants