Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#311 fix "workflow not found" error #312

Merged
merged 7 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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