mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-03 02:30:01 +08:00
✨ feat(env): 支持git更新
This commit is contained in:
@@ -317,6 +317,20 @@ class AliyunFileInfo:
|
||||
repository_id: str
|
||||
"""仓库ID"""
|
||||
|
||||
@classmethod
|
||||
async def get_client(cls) -> devops20210625Client:
|
||||
"""获取阿里云客户端"""
|
||||
config = open_api_models.Config(
|
||||
access_key_id=Aliyun_AccessKey_ID,
|
||||
access_key_secret=base64.b64decode(
|
||||
Aliyun_Secret_AccessKey_encrypted.encode()
|
||||
).decode(),
|
||||
endpoint=ALIYUN_ENDPOINT,
|
||||
region_id=ALIYUN_REGION,
|
||||
)
|
||||
|
||||
return devops20210625Client(config)
|
||||
|
||||
@classmethod
|
||||
async def get_file_content(
|
||||
cls, file_path: str, repo: str, ref: str = "main"
|
||||
@@ -335,16 +349,8 @@ class AliyunFileInfo:
|
||||
repository_id = ALIYUN_REPO_MAPPING.get(repo)
|
||||
if not repository_id:
|
||||
raise ValueError(f"未找到仓库 {repo} 对应的阿里云仓库ID")
|
||||
config = open_api_models.Config(
|
||||
access_key_id=Aliyun_AccessKey_ID,
|
||||
access_key_secret=base64.b64decode(
|
||||
Aliyun_Secret_AccessKey_encrypted.encode()
|
||||
).decode(),
|
||||
endpoint=ALIYUN_ENDPOINT,
|
||||
region_id=ALIYUN_REGION,
|
||||
)
|
||||
|
||||
client = devops20210625Client(config)
|
||||
client = await cls.get_client()
|
||||
|
||||
request = devops_20210625_models.GetFileBlobsRequest(
|
||||
organization_id=ALIYUN_ORG_ID,
|
||||
@@ -404,16 +410,7 @@ class AliyunFileInfo:
|
||||
if not repository_id:
|
||||
raise ValueError(f"未找到仓库 {repo} 对应的阿里云仓库ID")
|
||||
|
||||
config = open_api_models.Config(
|
||||
access_key_id=Aliyun_AccessKey_ID,
|
||||
access_key_secret=base64.b64decode(
|
||||
Aliyun_Secret_AccessKey_encrypted.encode()
|
||||
).decode(),
|
||||
endpoint=ALIYUN_ENDPOINT,
|
||||
region_id=ALIYUN_REGION,
|
||||
)
|
||||
|
||||
client = devops20210625Client(config)
|
||||
client = await cls.get_client()
|
||||
|
||||
request = devops_20210625_models.ListRepositoryTreeRequest(
|
||||
organization_id=ALIYUN_ORG_ID,
|
||||
@@ -459,16 +456,7 @@ class AliyunFileInfo:
|
||||
if not repository_id:
|
||||
raise ValueError(f"未找到仓库 {repo} 对应的阿里云仓库ID")
|
||||
|
||||
config = open_api_models.Config(
|
||||
access_key_id=Aliyun_AccessKey_ID,
|
||||
access_key_secret=base64.b64decode(
|
||||
Aliyun_Secret_AccessKey_encrypted.encode()
|
||||
).decode(),
|
||||
endpoint=ALIYUN_ENDPOINT,
|
||||
region_id=ALIYUN_REGION,
|
||||
)
|
||||
|
||||
client = devops20210625Client(config)
|
||||
client = await cls.get_client()
|
||||
|
||||
request = devops_20210625_models.GetRepositoryCommitRequest(
|
||||
organization_id=ALIYUN_ORG_ID,
|
||||
|
||||
Reference in New Issue
Block a user