Last active
May 13, 2019 16:26
-
-
Save coderbyheart/e6530a1854ac88de1af38c7d5a094e55 to your computer and use it in GitHub Desktop.
Open Source at Nordic Semiconductor
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
const Octokit = require('@octokit/rest') | |
const octokit = new Octokit() | |
// Compare: https://developer.github.com/v3/repos/#list-organization-repositories | |
const organizations = [ | |
'NordicSemiconductor', | |
'NordicPlayground', | |
'nRFCloud' | |
] | |
const repos = [] | |
organizations | |
.reduce( | |
(promise, organization) => promise.then(() => octokit.repos.listForOrg({ | |
org: organization, | |
type: 'public' | |
}).then(({data}) => data.map(({name, archived, license}) => { | |
repos.push({organization, name, archived, license: license && 'spdx_id' in license ? license.spdx_id : 'NOASSERTION'}) | |
}))), | |
Promise.resolve() | |
) | |
.then(() => { | |
console.log('# Open-Source at [Nordic Semiconductor](https://www.nordicsemi.com/)') | |
console.log('') | |
console.log('| Repo | License | Archived |') | |
console.log('|-------|-------|-------|') | |
repos.forEach(({organization, name, archived, license}) => { | |
console.log(`| [${organization}/${name}](https://github.com/${organization}/${name}) | ${license === | |
'NOASSERTION' ? ':question:' : license} | ${archived ? ':lock:' : ''} |`) | |
}) | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment