5ddb7fedcc2541916ad0a67c93c524ebcf460d49

Author
Minh Vu <vuhoangminh97@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

ci(deps): use resolved tag when syncing dependencies (#13764)

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>

Diff

 1diff --git a/.github/workflows/dependencies/updater.py b/.github/workflows/dependencies/updater.py
 2index 2765d9a52169688abd75171a5c097479af0c2c53..faab5a12c5044da22d3c0550868a867bcbb2115f 100644
 3--- a/.github/workflows/dependencies/updater.py
 4+++ b/.github/workflows/dependencies/updater.py
 5@@ -219,6 +219,7 @@ class Dependency:
 6             if status["has_updates"] is True:
 7                 short_sha = status["head_ref"][:8]
 8                 new_version = status["version"] if is_tag else short_sha
 9+                source_ref = new_version if is_tag else status["head_ref"]
10 
11                 try:
12                     branch_name = f"update/{self.path}/{new_version}"
13@@ -227,7 +228,7 @@ class Dependency:
14                     branch = Git.checkout_or_create_branch(branch_name)
15 
16                     # Update dependency files
17-                    self.__apply_upstream_changes()
18+                    self.__apply_upstream_changes(source_ref)
19 
20                     if not Git.repo_is_clean():
21                         # Update dependencies.yml file
22@@ -297,7 +298,7 @@ Check out the [list of changes]({status["compare_url"]}).
23         dep_yaml = DependencyStore.update_dependency_version(self.path, new_version)
24         DependencyStore.write_store(DEPS_YAML_FILE, dep_yaml)
25 
26-    def __apply_upstream_changes(self) -> None:
27+    def __apply_upstream_changes(self, ref: str) -> None:
28         # Patterns to ignore in copying files from upstream repo
29         GLOBAL_IGNORE = [".git", ".github", ".gitignore"]
30 
31@@ -306,12 +307,11 @@ Check out the [list of changes]({status["compare_url"]}).
32         postcopy = self.values.get("postcopy")
33 
34         repo = self.values["repo"]
35-        branch = self.values["branch"]
36         remote_url = f"https://github.com/{repo}.git"
37         repo_dir = os.path.join(TMP_DIR, repo)
38 
39         # Clone repository
40-        Git.clone(remote_url, branch, repo_dir, reclone=True)
41+        Git.clone(remote_url, ref, repo_dir, reclone=True)
42 
43         # Run precopy on tmp repo
44         if precopy is not None: