Populate reusedCode with fork upstream parent#127
Merged
haseebmalik18 merged 4 commits intoJul 13, 2026
Conversation
Collaborator
|
i'll fully review this after #125 gets merged but upon initial review, it looks good to me |
natalialuzuriaga
approved these changes
Jul 8, 2026
natalialuzuriaga
left a comment
Contributor
There was a problem hiding this comment.
Amazing job incorporating the fork functionality!! All LGTM!
Comment on lines
+130
to
+145
| async function detectForkParent(): Promise<ReusedCodeEntry | null> { | ||
| try { | ||
| const repoData = await octokit.rest.repos.get({ owner, repo }); | ||
| const { fork, parent } = repoData.data; | ||
|
|
||
| if (!fork || !parent) return null; | ||
|
|
||
| return { | ||
| name: parent.full_name, | ||
| URL: parent.html_url, | ||
| }; | ||
| } catch (error) { | ||
| log.error(`Failed to detect fork parent: ${error}`); | ||
| return null; | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
YES logic is great here 🔥
Comment on lines
+144
to
+147
| const reusedCode = mergeReusedCode(existingCodeJSON?.reusedCode ?? [], [ | ||
| ...(forkParent ? [forkParent] : []), | ||
| ...detectedDeps, | ||
| ]); |
Contributor
There was a problem hiding this comment.
Nice, I like how you used the existing merge function not just to merge the original deps with the newly generated deps but to also add forkParent too -- great use of this function!
…CodeFromForks # Conflicts: # src/__tests__/unit/helper.test.ts # src/helper.ts # src/main.ts
Collaborator
Author
|
@sachin-panayil if you can review this aswell #125 is merged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a repository is a fork, its upstream parent is now auto-added to
reusedCodeinstead of relying on manual entry.Changes
detectForkParent()helper readsfork/parentfrom the GitHub repo API and returns areusedCodeentry (ornullif not a fork or on error)getMetaDatafolds the fork upstream intoreusedCodealongside detected gov dependencies, de-duped against existing entries viamergeReusedCodeTesting
getMetaDatawiring): 261/261 pass[]closes: #94