|
5 | 5 | import os
|
6 | 6 | import sys
|
7 | 7 | import inspect
|
| 8 | +import subprocess |
| 9 | + |
| 10 | +from torchgen.executorch.api.et_cpp import return_names |
8 | 11 |
|
9 | 12 | GITHUB_TOKEN = None
|
10 | 13 |
|
11 | 14 | # Define the current version of the app
|
12 |
| -APP_VERSION = "1.0.0a" |
| 15 | +APP_VERSION = "1.0.1a" |
| 16 | + |
| 17 | +def get_repo_name(): |
| 18 | + """ |
| 19 | + Dynamically retrieves the repository name from the Git remote URL. |
| 20 | + """ |
| 21 | + try: |
| 22 | + # Run 'git remote get-url origin' to get the remote URL |
| 23 | + remote_url = subprocess.check_output( |
| 24 | + ["git", "remote", "get-url", "origin"], text=True |
| 25 | + ).strip() |
| 26 | + |
| 27 | + # Extract the repo name from the URL |
| 28 | + if remote_url.startswith("https://") or remote_url.startswith("http://"): |
| 29 | + repo_name = remote_url.split("/")[-2] + "/" + remote_url.split("/")[-1].replace(".git", "") |
| 30 | + elif remote_url.startswith("git@"): |
| 31 | + repo_name = remote_url.split(":")[-1].replace(".git", "") |
| 32 | + else: |
| 33 | + repo_name = None |
| 34 | + if repo_name is not None: |
| 35 | + print(f"Detected repository: {repo_name}") |
| 36 | + else: |
| 37 | + print(f"Could not detect repo name.") |
| 38 | + return repo_name |
| 39 | + except subprocess.CalledProcessError: |
| 40 | + print("Error: Unable to detect repository name. Ensure you're in a Git repository.") |
| 41 | + return None |
| 42 | + |
| 43 | +# Use the dynamic repo name |
| 44 | +REPO_NAME = get_repo_name() |
| 45 | + |
13 | 46 |
|
14 | 47 | # Hardcoded repository name
|
15 |
| -REPO_NAME = "RedNeckSnailSpit/IssueAutomationTest" |
| 48 | +# REPO_NAME = "RedNeckSnailSpit/IssueAutomationTest" |
16 | 49 |
|
17 | 50 | # Path to the config file
|
18 | 51 | CONFIG_FILE = "config.json"
|
@@ -163,6 +196,9 @@ def simulate_and_report_exception():
|
163 | 196 | if __name__ == "__main__":
|
164 | 197 | setup()
|
165 | 198 | config = load_config()
|
| 199 | + |
| 200 | + print(f"Repo Name: {REPO_NAME}") |
| 201 | + |
166 | 202 | GITHUB_TOKEN = config.get("github_token")
|
167 | 203 | if GITHUB_TOKEN is None:
|
168 | 204 | print("GitHub token not found in config.json. Please run the setup process.")
|
|
0 commit comments