你不能使用這個據我所知,但是你可以把一個工作區筆記本如果你調用代碼從回購通過筆記本:
repo_path = " /回購/ xyz_repo_path / xyz_repo_name”
repo_path_fs = " /工作區”+ repo_path
repo_branch = "主"
def checkRepoInfo ():
.notebook nb_context = json.loads (dbutils.notebook.entry_point.getDbutils () () .getContext () .toJson ())
api_url = nb_context [' extraContext '] [' api_url ']
api_token = nb_context [' extraContext '] [' api_token ']
db_repo_data = requests.get (f”{api_url} / api / 2.0 /回購”,標題={“授權”:f“無記名{api_token}}) . json ()
在db_repo_data db_repo(“回購”):
db_repo_id = db_repo (" id ")
db_repo_path = db_repo(“路徑”)
db_repo_branch = db_repo(“分支”)
db_repo_head_commit = db_repo (“head_commit_id”)
如果db_repo(“路徑”)= = repo_path:
打印(“Git提交信息:ID:{} |路徑:{}|分支:{}|提交:{}”。格式(db_repo_id、db_repo_path db_repo_branch db_repo_head_commit))
斷言db_repo_branch = = repo_branch
checkRepoInfo ()
嗨@Thomas樁,
隻是一個友好的後續。你能夠找到一個解決方案,或者你還需要幫助嗎?請讓我們知道。