You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

mikepenz/xray-action@v3.0.4双斜杠Endpoint致JIRA导入失败求助

解决mikepenz/xray-action@v3.0.4 Endpoint双斜杠导致的JIRA测试结果导入失败问题

问题详情

之前使用mikepenz/xray-action@v3.0.4将JUnit XML测试结果导入JIRA一直正常,近期突然触发失败,报错信息:

Error: 🔥 Failed to import: /__w/repo_name/repo_name/project_name/target/surefire-reports/junitreports/TEST-com.project.quality.project_name.test.cucumber.options.TestRunner.xml ({"name":"HTTPError","code":"ERR_NON_2XX_3XX_RESPONSE","timings":{"start":1713549674111,"socket":1713549674112,"lookup":1713549674112,"connect":1713549674112,"secureConnect":1713549674112,"upload":1713549674112,"response":1713549710288,"end":1713549710289,"phases":{"wait":1,"dns":0,"tcp":0,"tls":0,"request":0,"firstByte":36176,"download":1,"total":36178}}})

通过调试日志发现,Action内置的请求Endpoint存在多余斜杠:https://xray.cloud.getxray.app//api/v2/import/execution/junit,这是导致请求返回非2xx/3xx响应的核心原因,且该Endpoint为Action内置,无法直接修改代码。

当前使用的Workflow配置:

- name: "Import Regression Test results to Xray"
  if: always()
  uses: mikepenz/xray-action@v3.0.4
  with:
    username: ${{ secrets.XRAY_CLIENT_ID }}
    password: ${{ secrets.XRAY_CLIENT_SECRET }}
    testFormat: "junit"
    testPaths: "project_name/target/surefire-reports/junitreports/TEST-com.project.quality.project_name.test.cucumber.options.TestRunner.xml"
    projectKey: "PROJECT_KEY"
    testExecKey: ${{ github.event.inputs.jiraRegressionTestExecKey }}
    failOnImportError: false

可行解决方案

1. 升级Action到最新版本

该问题属于Action内部的Endpoint拼接逻辑错误,官方后续版本大概率已修复此问题。直接将Workflow中的Action版本从v3.0.4升级到最新稳定版(如v4.x系列):

uses: mikepenz/xray-action@v4

(可前往项目仓库确认最新版本号,替换为具体的版本标签更稳妥)

2. 手动指定正确的Endpoint覆盖内置值

若暂时无法升级版本,可在Workflow的with参数中手动传入修正后的Endpoint,覆盖Action内置的错误值:

- name: "Import Regression Test results to Xray"
  if: always()
  uses: mikepenz/xray-action@v3.0.4
  with:
    username: ${{ secrets.XRAY_CLIENT_ID }}
    password: ${{ secrets.XRAY_CLIENT_SECRET }}
    testFormat: "junit"
    testPaths: "project_name/target/surefire-reports/junitreports/TEST-com.project.quality.project_name.test.cucumber.options.TestRunner.xml"
    projectKey: "PROJECT_KEY"
    testExecKey: ${{ github.event.inputs.jiraRegressionTestExecKey }}
    failOnImportError: false
    endpoint: "https://xray.cloud.getxray.app/api/v2/import/execution/junit" # 移除多余斜杠的正确Endpoint

3. 使用修复后的Fork版本

如果上述两种方式都无法实施,可fork原仓库,手动修复代码中Endpoint拼接的双斜杠问题,之后在Workflow中使用自己的fork版本:

uses: your-github-username/xray-action@your-fix-branch-name

内容的提问来源于stack exchange,提问作者Manjiri

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 11:21:26