Skip to content

Commit f82b5d0

Browse files
committed
Use specific SHA and URL for conan recipe in CI
1 parent 08a943e commit f82b5d0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

conanfile.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from os import path
1+
from os import path, environ
22
from conan import ConanFile
33
from conan.errors import ConanInvalidConfiguration
44
from conan.tools.build import check_min_cppstd
@@ -44,7 +44,12 @@ def _compilers_minimum_version(self):
4444
def export(self):
4545
copy(self, "version.txt", self.recipe_folder, self.export_folder)
4646
git = Git(self, self.recipe_folder)
47-
scm_url, scm_commit = git.get_url_and_commit()
47+
if environ.get("CI") == "true":
48+
scm_commit = environ.get("GITHUB_SHA")
49+
scm_url = f"{environ.get('GITHUB_SERVER_URL')}/{environ.get('GITHUB_REPOSITORY')}"
50+
else:
51+
scm_url, scm_commit = git.get_url_and_commit()
52+
4853
update_conandata(self, {"sources": {"commit": scm_commit, "url": scm_url}})
4954

5055
def set_version(self):

0 commit comments

Comments
 (0)