Skip to content

Instantly share code, notes, and snippets.

@liddiard
Created July 14, 2017 20:59
Show Gist options
  • Save liddiard/5ca872ad2e20b57a31357701a384f7a7 to your computer and use it in GitHub Desktop.
Save liddiard/5ca872ad2e20b57a31357701a384f7a7 to your computer and use it in GitHub Desktop.
Get a newline-separated list of a GitHub user's public repositories with repo title, GitHub URL, and description.
const request = require('superagent');
const username = 'liddiard'; // change username as needed
request
.get(`https://api.github.com/users/${username}/repos`)
.query({page: 1}) // increment this page number as needed
.then(res =>
fs.appendFile('repos.txt', res.body.map(repo =>
[repo.name, repo.html_url, repo.description].join('\n'))
.join('\n\n') + '\n'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment