Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-env node */
const config = require("./config.json");
const github = require("./lib/github.js");
const w3c = require('node-w3capi');
// based on a downloaded a local copy from https://labs.w3.org/hatchery/repo-manager/api/users when logged in there, filtered to leave only list of ghID
const ashnazgusers = require('./ashnazg-users.json');
w3c.apiKey = config.w3capikey;
if (!process.argv[2] || process.argv[2].indexOf('/') === -1) {
console.error("Required: name of repo to check, e.g. w3c/webrtc-pc");
process.exit(2);
}
const [owner, repo] = process.argv[2].split('/');
github.listRepoContributors(owner, repo).then(contributors => {
Promise.all(contributors.map(contributor => {
return new Promise(function(res, rej) {
w3c.user({type: 'github', id: contributor.id}).fetch(function(err, /* w3cuser */) {
if (err) {
if (err.status === 404) {
// is the user known in ahsnazg local db?
if (ashnazgusers.indexOf(contributor.id) !== -1) {