How Repository Forks Are Filtered Out When Generating the GitHub Résumé
The résumé generator explicitly skips any repository where repo.fork is not strictly false, ensuring only original projects appear in the final output.
When building a visual CV from GitHub data, the resume.github.com project filters out forked repositories to highlight authentic contributions. This client-side filtering occurs immediately after fetching the user's public repository list from the GitHub API, ensuring the generated résumé showcases only original work.
The Fork Filtering Logic in githubresume.js
The core filtering mechanism resides in js/githubresume.js, where the script processes the JSON response from github_user_repos. Inside the jQuery iteration loop, an explicit guard clause discards any repository marked as a fork:
$.each(data, function(i, repo) {
// Skip forked repositories
if (repo.fork !== false) {
return; // ← ignore this repo
}
// Process original repositories only...
});
The repo.fork property is a Boolean supplied directly by the GitHub API (true indicates a fork, false indicates an original repository). When the condition evaluates to truthy, the return statement immediately exits the current iteration, preventing that repository from being added to the sorted array that drives the résumé UI.
Why the Filter Uses !== false Instead of === true
The implementation uses the loose inequality check repo.fork !== false rather than repo.fork === true for defensive programming reasons. This approach catches three distinct states:
- Explicit forks: Where
repo.fork === true - Null values: Where the property might be
nulldue to API inconsistencies - Undefined values: Where the property is missing entirely from the response
Any repository that is not explicitly marked as false is treated as potentially being a fork and is therefore excluded from the résumé generation. This conservative approach ensures no forked repositories slip through due to unexpected API behavior.
Handling Edge Cases When All Repositories Are Forks
If a user has no original repositories—meaning every public repository is a fork—the filtering logic results in an empty sorted array. The script handles this edge case gracefully by displaying a fallback message to the visitor.
According to the implementation in js/githubresume.js (around lines 48-50), when no repositories pass the fork filter, the résumé displays a friendly notification stating that the user's repositories appear to be forks. This prevents the generation of an empty or broken CV page while transparently explaining why no projects are listed.
Summary
- Location: Fork filtering occurs in
js/githubresume.jswithin the jQuery$.eachloop processing the GitHub API response. - Mechanism: The condition
if (repo.fork !== false)immediately returns for any repository not explicitly marked as original. - API Property: The filter relies on the Boolean
forkfield provided by GitHub's repository endpoint. - Edge Handling: When all repositories are forks, the script falls back to a message explaining the absence of displayable projects.
- Template: Surviving repositories are rendered using
views/job.htmlafter passing the filter.
Frequently Asked Questions
What happens if a repository is a fork but has significant original contributions?
The résumé generator treats all repositories with repo.fork !== false identically, regardless of subsequent contributions. Even if you have heavily modified a forked repository, it will be excluded from the generated CV. To showcase such work, you would need to create an original repository or ensure the fork is detached through GitHub's support channels.
Does the fork filter affect private repositories?
No, the filter only applies to public repositories retrieved via the github_user_repos API endpoint. The resume.github.com project does not access private repository data due to OAuth scope limitations in its client-side implementation. Only your publicly visible original repositories appear in the final résumé output.
Where can I find the exact line of code that performs the fork check?
The explicit fork check resides in js/githubresume.js at approximately lines 20-24. The specific implementation uses the condition if (repo.fork !== false) { return; } inside the $.each(data, function(i, repo) { ... }) loop. You can view the source directly at the repository path resume/resume.github.com/blob/master/js/githubresume.js.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →