feat: Add project branch env

This commit is contained in:
M307 2024-02-02 14:51:34 +07:00
parent edf2bb754d
commit d549915e0f

View File

@ -30,6 +30,7 @@ LOGGER = logging.getLogger(__name__)
USERNAME = os.getenv('GITHUB_USERNAME')
REPOSITORY = os.getenv('GITHUB_REPOSITORY')
PROJECT_ID = os.getenv('GITHUB_PROJECT_ID')
PROJECT_BRANCH = os.getenv('GITHUB_PROJECT_BRANCH')
# Check is DEV_MODE
DEVMODE = sys.argv[1] == "dev" if len(sys.argv) > 1 else False
@ -111,7 +112,7 @@ async def main():
continue
await download_json(
url=RAW_GIT2.format(PATH=f"{USERNAME}/{REPOSITORY}/-/raw/master/{os.getenv('FOLDER')}/{filename}"),
url=RAW_GIT2.format(PATH=f"{USERNAME}/{REPOSITORY}/-/raw/{PROJECT_BRANCH}/{os.getenv('FOLDER')}/{filename}"),
filename=filename,
path=os.path.join("raw", "data")
)
@ -122,7 +123,7 @@ async def main():
langPath = await request(GIT2.format(PATH=f"/projects/{PROJECT_ID}/repository/tree?recursive=true&path={os.getenv('LANG_FOLDER')}"))
for lang in langPath:
await download_json(
url=RAW_GIT2.format(PATH=f"{USERNAME}/{REPOSITORY}/-/raw/master/{lang['path']}"),
url=RAW_GIT2.format(PATH=f"{USERNAME}/{REPOSITORY}/-/raw/{PROJECT_BRANCH}/{lang['path']}"),
filename=lang["name"],
path=os.path.join("raw", "langs")
)