Skip to content

Commit 33b5470

Browse files
committed
error handling for the zero commit case
1 parent d525764 commit 33b5470

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

api/ruby/find-inactive-members/find_inactive_members.rb

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,19 @@ def make_active(login)
114114
def commit_activity(repo)
115115
# get all commits after specified date and iterate
116116
info "...commits"
117-
@client.commits_since(repo, @date).each do |commit|
118-
# if commmitter is a member of the org and not active, make active
119-
if commit["author"].nil?
120-
add_unrecognized_author(commit[:commit][:author])
121-
next
122-
end
123-
if t = @members.find {|member| member[:login] == commit["author"]["login"] && member[:active] == false }
124-
make_active(t[:login])
117+
begin
118+
@client.commits_since(repo, @date).each do |commit|
119+
# if commmitter is a member of the org and not active, make active
120+
if commit["author"].nil?
121+
add_unrecognized_author(commit[:commit][:author])
122+
next
123+
end
124+
if t = @members.find {|member| member[:login] == commit["author"]["login"] && member[:active] == false }
125+
make_active(t[:login])
126+
end
125127
end
128+
rescue Octokit::Conflict
129+
info "...no commits"
126130
end
127131
end
128132

0 commit comments

Comments
 (0)