github-labels icon indicating copy to clipboard operation
github-labels copied to clipboard

Programmatic usage

Open RichardLitt opened this issue 7 years ago • 0 comments

I would like to be able to run this programmatically without needing to use the CLI every time, as I maintain a lot of repos and sometimes just want to ensure that they all have the right labels. I am pretty sure this isn't right, as it tends to shut down my Spotify music when I run it (fun!).

const exec = require('child_process').exec
const githubRepos = require('github-repositories')
const orgs = [
  'ipfs',
  'ipld',
  'libp2p',
  'multiformats'
]

orgs.forEach((org) =>
  githubRepos(org).then(data =>
    data.map((item) => {
      exec('labels -c githubLabels.json ' + item.full_name,
        (error, stdout, stderr) => {
          console.log(`stdout: ${stdout}`)
          console.log(`stderr: ${stderr}`)
          if (error !== null) {
            console.log(`exec error: ${error}`)
          }
        }
      )
    })
  )
)

Any ideas?

RichardLitt avatar Nov 11 '16 07:11 RichardLitt