parseArtifactName extracts run_id, job_id, and matrix_name from artifact name. Functional tests: junit-xml--{run_id}--{job_id}--{run_attempt}--{matrix_name}--{display_name}--functional-test Unit/integration: junit-xml--{run_id}--{job_id}--{run_attempt}--unit-test Returns: runID, jobID, matrixName (
(artifactName string)
| 200 | // Unit/integration: junit-xml--{run_id}--{job_id}--{run_attempt}--unit-test |
| 201 | // Returns: runID, jobID, matrixName ("unknown" for fields that are absent or unparseable) |
| 202 | func parseArtifactName(artifactName string) (runID string, jobID string, matrixName string) { |
| 203 | parts := strings.Split(artifactName, "--") |
| 204 | if len(parts) < 3 { |
| 205 | return "unknown", "unknown", "unknown" |
| 206 | } |
| 207 | |
| 208 | runID = parts[1] |
| 209 | |
| 210 | jobID = parts[2] |
| 211 | if jobID == "" { |
| 212 | jobID = "unknown" |
| 213 | } |
| 214 | |
| 215 | // Functional test artifacts carry a matrix name (DB config) at parts[4]. |
| 216 | // Unit/integration artifacts have only 5 parts where parts[4] is the test type |
| 217 | // (e.g. "unit-test"), not a matrix name. Functional artifacts have >=7 parts. |
| 218 | if len(parts) >= 6 { |
| 219 | matrixName = parts[4] |
| 220 | } else { |
| 221 | matrixName = "unknown" |
| 222 | } |
| 223 | |
| 224 | return runID, jobID, matrixName |
| 225 | } |
| 226 | |
| 227 | // buildGitHubURL constructs GitHub Actions URL from run/job IDs |
| 228 | // If jobID == "unknown": https://github.com/{repo}/actions/runs/{runID} |