Permalink
Please
sign in to comment.
Showing
with
26 additions
and 7 deletions.
- +1 −1 Gemfile
- +6 −6 Gemfile.lock
- +19 −0 lib/tasks/sync.rake
@@ -0,0 +1,19 @@ | |||
namespace :sync do | |||
desc "Restrict permissions on reviews repository to those that need it" | |||
task :assignees => :environment do | |||
# We run this task daily on Heroku | |||
reviews_repo = Rails.application.settings["reviews"] | |||
open_issues = GITHUB.list_issues(reviews_repo, :state => 'open') | |||
|
|||
open_issues.each do |issue| | |||
editor = issue.body.match(/\*\*Editor:\*\*\s*(@\S*|Pending)/i)[1] | |||
reviewers = issue.body.match(/Reviewers?:\*\*\s*(.+?)\r?\n/)[1].split(", ") - ["Pending"] | |||
assignees = reviewers << editor unless editor == "Pending" | |||
|
|||
if assignees | |||
assignees = assignees.collect {|a| a.sub!(/^@/, '')} | |||
GITHUB.add_assignees(reviews_repo, issue.number, assignees) | |||
end | |||
end | |||
end | |||
end |
0 comments on commit
4bedc9f