Last active
July 2, 2020 02:55
-
-
Save yucao24hours/12349a063a7d6e9f2ad72d91eeb0f925 to your computer and use it in GitHub Desktop.
Get .circleci/config.yml in each repository entire my company's org (to migrate CircleCI to GitHub Actions)
This file contains hidden or 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
require 'octokit' | |
client = Octokit::Client.new(access_token: 'your_personal_access_token') | |
client.auto_paginate = true | |
File.open('configs.md', 'w') do |file| | |
repos = client.org_repos('awesome_org_name') | |
repos.each.with_index(1) do |repo, index| | |
puts "#{index}: #{repo[:name]}" | |
begin | |
content = client.contents(repo[:full_name], path: '.circleci/config.yml') | |
file.puts "- #{content[:html_url]}" # Because I wanna create url list of Markdown | |
rescue Octokit::NotFound | |
next | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment