Skip to content

Commit 8947ea4

Browse files
committed
use default branch
1 parent 4ca9076 commit 8947ea4

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

github-runner-manager/tests/integration/conftest.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"""Fixtures for github-runner-manager integration tests."""
55

66
import logging
7-
import subprocess
87
import time
98
from pathlib import Path
109
from typing import Generator
@@ -280,16 +279,9 @@ def github_branch(
280279
"""
281280
test_branch = f"test-{test_config.test_id}"
282281

283-
sha_result = subprocess.run(
284-
["/usr/bin/git", "rev-parse", "HEAD"],
285-
capture_output=True,
286-
text=True,
287-
check=True,
288-
)
289-
current_commit_sha = sha_result.stdout.strip()
290-
282+
default_branch = github_repository.get_branch(github_repository.default_branch)
291283
branch_ref = github_repository.create_git_ref(
292-
ref=f"refs/heads/{test_branch}", sha=current_commit_sha
284+
ref=f"refs/heads/{test_branch}", sha=default_branch.commit.sha
293285
)
294286

295287
# Wait for branch to be available, GitHub is eventually consistent
@@ -301,7 +293,11 @@ def github_branch(
301293
while time.time() - start_time < timeout:
302294
try:
303295
branch = github_repository.get_branch(test_branch)
304-
logger.info("Created test branch: %s at SHA: %s", test_branch, current_commit_sha)
296+
logger.info(
297+
"Created test branch: %s at SHA: %s",
298+
test_branch,
299+
default_branch.commit.sha,
300+
)
305301
break
306302
except Exception as e:
307303
elapsed = time.time() - start_time

0 commit comments

Comments
 (0)