Spaces:
Sleeping
Sleeping
import os | |
import subprocess | |
import argparse | |
# パーサーの作成 | |
parser = argparse.ArgumentParser(description="This is a sample script.") | |
# 引数の定義 | |
parser.add_argument("--key", type=int, help="Your PAT", required=True) | |
# GitHubリポジトリのURL | |
repo_url = "https://github.com/OzoneAsai/flashcards.git" | |
if github_token: | |
# リポジトリURLにトークンを含めたURLを作成 | |
repo_url_with_token = repo_url.replace("https://", f"https://{github_token}@") | |
try: | |
# git clone コマンドを実行 | |
subprocess.run(["git", "clone", repo_url_with_token], check=True) | |
print("リポジトリのクローンが成功しました。") | |
except subprocess.CalledProcessError as e: | |
print(f"クローンに失敗しました: {e}") | |
else: | |
print("GitHubトークンが見つかりません。環境変数 'ghKey' または 'PAT' が設定されているか確認してください。") | |