I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
Get the metadata and content of all files in a given GitHub repo using the GraphQL API
You might want to get a tree summary of files in a repo without downloading the repo, or maybe you want to lookup the contents of a file again without download the whole repo.
The approach here is to query data from GitHub using the Github V4 GraphQL API.
This file contains 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
# See: https://github.com/dependabot/dependabot-script/blob/master/update-script.rb | |
# Other update script logic | |
vulnerabilities = VulnerabilityFetcher.new(dependency_names, package_manager).fetch_advisories | |
# Note you may not just want top level depending on your use case | |
dependencies.select(&:top_level?).each do |dep| | |
security_vulnerabilities = [] | |
if vulnerabilities.any? | |
security_vulnerabilities = vulnerabilities[dep.name.to_sym].map do |vuln| |