File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed
github-runner-manager/tests/integration Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change 44"""Fixtures for github-runner-manager integration tests."""
55
66import logging
7- import subprocess
87import time
98from pathlib import Path
109from 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
You can’t perform that action at this time.
0 commit comments