Skip to content

Instantly share code, notes, and snippets.

@thattommyhall
Last active November 3, 2020 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thattommyhall/6c0a22eba96fc5876223d42d7973c0c4 to your computer and use it in GitHub Desktop.
Save thattommyhall/6c0a22eba96fc5876223d42d7973c0c4 to your computer and use it in GitHub Desktop.
find all repos in any org you have access to that have both workflows and secrets
require "octokit"
client = Octokit::Client.new(:access_token => "SOMETHING")
client.orgs.each do |org|
org_name = org.login
client.org_repositories(org_name).each do |repo|
repo_name = repo.full_name
repo_workflows = client.workflows(repo_name)
if repo_workflows.total_count > 0
secrets_response = client.list_secrets(repo_name)
if secrets_response.total_count > 0
puts repo_name
puts "private: #{repo.private}"
puts secrets_response.secrets.map(&:name).join(", ")
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment