Skip to content

Commit 6466c50

Browse files
committed
Fetch latest main before computing merge-base
1 parent 34c4fa2 commit 6466c50

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

buildkite/pipeline_generator/utils_lib/git_utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ def get_merge_base_commit() -> Optional[str]:
99
merge_base = os.getenv("MERGE_BASE_COMMIT")
1010
if merge_base:
1111
return merge_base
12+
# Fetch latest main to ensure origin/main is up-to-date on agent workspaces
13+
subprocess.run(
14+
["git", "fetch", "origin", "main", "--no-tags", "--depth=1"],
15+
capture_output=True,
16+
check=False,
17+
)
1218
# Compute merge base if not provided
1319
try:
1420
result = subprocess.run(

0 commit comments

Comments
 (0)