Skip to content

Instantly share code, notes, and snippets.

@briandoll
Last active September 28, 2016 00:00
Show Gist options
  • Save briandoll/ef71741af77bd150caf5555daeea657c to your computer and use it in GitHub Desktop.
Save briandoll/ef71741af77bd150caf5555daeea657c to your computer and use it in GitHub Desktop.
Scan all public repos of a GitHub org with SourceClear
#!/usr/bin/env ruby
require 'octokit'
Octokit.auto_paginate = true
client = Octokit::Client.new(:access_token => ENV["GITHUB_TOKEN"])
org = ARGV[0]
unless org
puts "Usage: scan-org orgname"
exit
end
repos = client.repos org
puts "#{org}: Scanning #{repos.size} repositories..."
repos.each do |repo|
url = repo.html_url
puts "Scanning #{url}..."
cmd = "srcclr scan --url #{url}"
`#{cmd}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment