Sha256: 8a7942c49e0caf1a87084c495e67709a638faea42e858e19f896929cc8d15256
Contents?: true
Size: 1.37 KB
Versions: 3
Compression:
Stored size: 1.37 KB
Contents
#!/usr/bin/env ruby require "bundler/inline" gemfile do source "https://rubygems.org" gem "multi_repo", require: "multi_repo/cli", path: File.expand_path("..", __dir__) end opts = Optimist.options do opt :users, "The users to make alumni.", :type => :strings, :required => true opt :org, "The org in which user belongs", :type => :string, :required => true MultiRepo::CLI.common_options(self, :only => :dry_run) end class MultiRepo::MakeAlumni attr_reader :org, :dry_run, :github def initialize(org:, dry_run:, **_) @org = org @dry_run = dry_run @github = MultiRepo::Service::Github.new(dry_run: dry_run) end def run(user) progress = MultiRepo::CLI.progress_bar(teams.size + repos.size) github.add_team_membership(org, "alumni", user) progress.increment teams.each do |team| next if team == "alumni" github.remove_team_membership(org, team, user) progress.increment end repos.each do |repo| github.remove_collaborator(repo, user) progress.increment end progress.finish end private def teams @teams ||= github.team_names(org) end def repos @repos ||= github.client.org_repos(org).reject(&:archived?).map(&:full_name).sort end end make_alumni = MultiRepo::MakeAlumni.new(**opts) opts[:users].each do |user| puts MultiRepo::CLI.header(user) make_alumni.run(user) end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
multi_repo-0.2.1 | scripts/make_alumni |
multi_repo-0.2.0 | scripts/make_alumni |
multi_repo-0.1.2 | scripts/make_alumni |