From 25fb9702d4c9e05c68e2c90522d4a00e9ed37e5d Mon Sep 17 00:00:00 2001 From: Artem Yegorov Date: Wed, 4 Sep 2024 17:39:16 +0300 Subject: [PATCH] #325: fix empty author id --- judges/github-events/github-events.rb | 3 ++- test/judges/test-github-events.rb | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/judges/github-events/github-events.rb b/judges/github-events/github-events.rb index aa2fa23e..3cd2cd16 100644 --- a/judges/github-events/github-events.rb +++ b/judges/github-events/github-events.rb @@ -49,7 +49,8 @@ def self.fetch_contributors(fact, repo) contributors = Set.new if last Fbe.octo.compare(repo, last.tag, fact.tag)[:commits].each do |commit| - contributors << commit[:author][:id] + author_id = commit.dig(:author, :id) + contributors << author_id if author_id end else Fbe.octo.contributors(repo).each do |contributor| diff --git a/test/judges/test-github-events.rb b/test/judges/test-github-events.rb index 2509fd9a..9e2d74ae 100644 --- a/test/judges/test-github-events.rb +++ b/test/judges/test-github-events.rb @@ -879,7 +879,10 @@ def test_release_event_contributors { sha: 'a50489ead5e8aa6', author: { login: 'Yegorov', id: 2_566_462 } }, { sha: 'b50489ead5e8aa7', author: { login: 'Yegorov64', id: 2_566_463 } }, { sha: 'c50489ead5e8aa8', author: { login: 'Yegorov128', id: 2_566_464 } }, - { sha: 'd50489ead5e8aa9', author: { login: 'Yegorov', id: 2_566_462 } } + { sha: 'd50489ead5e8aa9', author: { login: 'Yegorov', id: 2_566_462 } }, + { sha: 'e50489ead5e8aa9', author: nil }, + { sha: 'e60489ead5e8aa9' }, + { sha: 'e70489ead5e8aa9', author: { login: 'NoUser' } } ], files: [ { additions: 15, deletions: 40, changes: 55 },