Skip to content

Commit 899867c

Browse files
authored
Merge pull request #23 from code0-tech/22-only-consider-check-runs-on-main-for-component-updates
Filter check runs for default branch in component updater
2 parents ca5a449 + 2975fb4 commit 899867c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

lib/pyxis/managed_versioning/component_updater.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ def filter_for_passing_checks(commits)
126126
conclusions = GithubClient.octokit
127127
.check_runs_for_ref(component.github_path, commit)
128128
.check_runs
129+
.select { |run| check_run_on_default_branch?(component, run) }
129130
.map(&:conclusion)
130131
!conclusions.empty? && conclusions.all? { |conclusion| conclusion == 'success' }
131132
end
@@ -135,6 +136,13 @@ def filter_for_passing_checks(commits)
135136
filtered_commits
136137
end
137138

139+
def check_run_on_default_branch?(component, run)
140+
GithubClient.octokit.check_suite(
141+
component.github_path,
142+
run.check_suite.id
143+
).head_branch == component.default_branch
144+
end
145+
138146
def version_update_loop?(update_title)
139147
commits = GithubClient.without_auto_pagination(GithubClient.octokit) do |octokit|
140148
octokit.list_commits(

0 commit comments

Comments
 (0)