|
15 | 15 |
|
16 | 16 | # Configuration |
17 | 17 | GITHUB_REPO = "ESA-APEx/apex_algorithms" |
18 | | -GITHUB_TOKEN = os.getenv("APEX_ISSUE_TOKEN") |
| 18 | +GITHUB_TOKEN = os.getenv("GITHUB_TOKEN") |
19 | 19 | ISSUE_LABEL = "benchmark-failure" |
20 | 20 | SCENARIO_BASE_PATH = "qa/benchmarks/scenarios/" |
21 | 21 | WORKFLOW_BASE_URL = f"https://github.com/{os.getenv('GITHUB_REPOSITORY')}/actions/runs/{os.getenv('GITHUB_RUN_ID')}" |
@@ -174,9 +174,33 @@ def build_issue_body(scenario, logs, failure_count): |
174 | 174 | ``` |
175 | 175 | """ |
176 | 176 |
|
177 | | -def get_scenario_link(scenario_id): |
178 | | - """Generate link to scenario source code""" |
179 | | - return f"https://github.com/{GITHUB_REPO}/tree/main/{SCENARIO_BASE_PATH}{scenario_id}.py" |
| 177 | +def get_scenario_link(scenario_id: str) -> str: |
| 178 | + """Generate link to process graph file at specific commit""" |
| 179 | + # Get the current commit SHA from GitHub environment |
| 180 | + commit_sha = os.getenv("GITHUB_SHA", "main") # Fallback to 'main' if not in CI |
| 181 | + |
| 182 | + # Base repository URL |
| 183 | + base_url = f"https://github.com/{GITHUB_REPO}/blob/{commit_sha}" |
| 184 | + |
| 185 | + # Search path pattern based on your repository structure |
| 186 | + search_root = Path("algorithm_catalog") |
| 187 | + |
| 188 | + # Look for matching scenario in provider directories |
| 189 | + for provider_dir in search_root.iterdir(): |
| 190 | + if not provider_dir.is_dir(): |
| 191 | + continue |
| 192 | + |
| 193 | + # Check for <provider>/<scenario_id>/openeo_udp/<scenario_id>.json |
| 194 | + scenario_path = ( |
| 195 | + provider_dir / |
| 196 | + scenario_id / |
| 197 | + "benchmark_scenarios" / |
| 198 | + f"{scenario_id}.json" |
| 199 | + ) |
| 200 | + |
| 201 | + if scenario_path.exists(): |
| 202 | + return f"{base_url}/{"algorithm_catalog"}/{scenario_path.as_posix()}" |
| 203 | + |
180 | 204 |
|
181 | 205 | def create_new_issue(scenario, logs): |
182 | 206 | """Create a new GitHub issue""" |
|
0 commit comments