Skip to content

Commit

Permalink
Merge pull request #312 from Suban05/311
Browse files Browse the repository at this point in the history
#311 fix "workflow not found" error
  • Loading branch information
yegor256 authored Aug 25, 2024
2 parents 8c8278e + 7dfd2e0 commit 8e43487
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ GEM
net-http
faraday-retry (2.2.1)
faraday (~> 2.0)
fbe (0.0.60)
fbe (0.0.61)
backtrace (> 0)
decoor (> 0)
factbase (> 0)
Expand Down
1 change: 1 addition & 0 deletions judges/github-events/github-events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def self.fetch_workflows(pr)
succeeded_builds = 0
failed_builds = 0
Fbe.octo.check_runs_for_ref(pr[:base][:repo][:full_name], pr[:head][:sha])[:check_runs].each do |run|
next unless run[:app][:slug] == 'github-actions'
workflow = Fbe.octo.workflow_run(
pr[:base][:repo][:full_name],
Fbe.octo.workflow_run_job(pr[:base][:repo][:full_name], run[:id])[:run_id]
Expand Down
2 changes: 1 addition & 1 deletion judges/github-events/scan-many-repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ options:
repositories: yegor256/judges,yegor256/factbase,zerocracy/baza
runs: 5
expected:
- /fb[count(f)=6]
- /fb[count(f)=7]
16 changes: 14 additions & 2 deletions test/judges/test-github-events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -917,12 +917,24 @@ def test_pull_request_event_with_comments

def test_count_numbers_of_workflow_builds
fb = Factbase.new
load_it('github-events', fb, Judges::Options.new({ 'repositories' => 'foo/foo', 'testing' => true }))
f = fb.query('(eq what "pull-was-merged")').each.to_a.first
load_it('github-events', fb, Judges::Options.new({ 'repositories' => 'zerocracy/baza', 'testing' => true }))
f = fb.query('(and (eq what "pull-was-merged") (eq event_id 42))').each.to_a.first
assert_equal(4, f.succeeded_builds)
assert_equal(2, f.failed_builds)
end

def test_count_numbers_of_workflow_builds_only_from_github
fb = Factbase.new
load_it(
'github-events',
fb,
Judges::Options.new({ 'repositories' => 'zerocracy/judges-action', 'testing' => true })
)
f = fb.query('(and (eq what "pull-was-merged") (eq event_id 43))').each.to_a.first
assert_equal(3, f.succeeded_builds)
assert_equal(2, f.failed_builds)
end

private

def stub_event(*json)
Expand Down

0 comments on commit 8e43487

Please sign in to comment.