Skip to content

Commit

Permalink
auto-merge: consider skipped test runs as successful (#38753)
Browse files Browse the repository at this point in the history
  • Loading branch information
alafanechere authored May 29, 2024
1 parent f2560a8 commit b4d7a64
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
8 changes: 8 additions & 0 deletions airbyte-ci/connectors/auto_merge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,11 @@ poetry run auto-merge

The execution will set the `GITHUB_STEP_SUMMARY` env var with a markdown summary of the PRs that
have been merged.

## Changelog

### 0.1.1
Consider skipped check runs as successful.

### 0.1.0
Initial release
2 changes: 1 addition & 1 deletion airbyte-ci/connectors/auto_merge/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "auto-merge"
version = "0.1.0"
version = "0.1.1"
description = ""
authors = ["Airbyte <[email protected]>"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion airbyte-ci/connectors/auto_merge/src/auto_merge/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,6 @@ def auto_merge() -> None:
back_off_if_rate_limited(gh_client)
if merged_pr := process_pr(repo, pr, required_passing_contexts, dry_run):
merged_prs.append(merged_pr)
if os.environ["GITHUB_STEP_SUMMARY"]:
if "GITHUB_STEP_SUMMARY" in os.environ:
job_summary_path = Path(os.environ["GITHUB_STEP_SUMMARY"]).write_text(generate_job_summary_as_markdown(merged_prs))
logger.info(f"Job summary written to {job_summary_path}")
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ def head_commit_passes_all_required_checks(
head_commit: GithubCommit, pr: PullRequest, required_checks: set[str]
) -> Tuple[bool, Optional[str]]:
successful_status_contexts = [commit_status.context for commit_status in head_commit.get_statuses() if commit_status.state == "success"]
successful_check_runs = [check_run.name for check_run in head_commit.get_check_runs() if check_run.conclusion == "success"]
successful_check_runs = [
check_run.name
for check_run in head_commit.get_check_runs()
# Github considers a required check as passing if it has a conclusion of "success" or "skipped"
if check_run.conclusion == "success" or check_run.conclusion == "skipped"
]
successful_contexts = set(successful_status_contexts + successful_check_runs)
if not required_checks.issubset(successful_contexts):
return False, "not all required checks passed"
Expand Down

0 comments on commit b4d7a64

Please sign in to comment.