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

Postman CLI GitHub Action执行Collection突然失效求助

问题:Postman CLI在GitHub Action中执行postman api lint报错,找不到配置文件

之前一直正常运行的Postman CLI GitHub Action,近一周出现异常。Action配置如下:

runs-on: ubuntu-latest
steps:
  - uses: actions/checkout@v3
  - name: Install Postman CLI
    run: |
      curl -o- "https://dl-cli.pstmn.io/install/linux64.sh" | sh
  - name: Login to Postman CLI
    run: postman login --with-api-key ${{ secrets.POSTMAN_API_KEY }}
  - name: Run API tests
    run: |
      postman collection run "14779683-c20279a2-e01b-42d7-a435-cb45a05d982c" -e "14779683-fb25fdcd-2eee-4e1a-9bc5-5c13edfef1a5" --integration-id "135195-${{ github.run_id }}"
      postman api lint --integration-id 135195-${{ github.run_id }}

API密钥有效,Collection测试可正常完成,但执行后出现以下错误:

Postman CLI run data uploaded to Postman Cloud successfully.
You can view the run data in Postman at: https://go.postman.co/workspace/3998f5e5-fd98-4009-8cac-16dbba3f93fc/api/f79c4bd4-cf58-4ff8-9237-2f4a87135b6c/run/14779683-dcbd86b3-9124-4295-b476-03a1d7ab6768
Error: Couldn't find the Postman config file in the current directory.
Try re-integrating this folder with your Postman API. https://go.pstmn.io/v10-git-local-docs

疑问:是否是Postman CLI更新导致该问题?缺少什么配置?


解决方案

  • 这个错误源于postman api lint命令需要本地存在Postman配置文件(通常是.postman/api.json),而你的GitHub Action运行环境中没有这个文件。
  • 大概率是Postman CLI近期更新后,api lint的执行逻辑发生变化,不再支持仅通过集成ID直接运行,必须依赖本地与Postman API关联的配置文件。
  • 可通过以下方式解决:
    1. 提交本地生成的配置文件:在本地项目目录执行postman api integrate命令,关联你的Postman API,生成.postman/api.json后将该文件提交到GitHub仓库。
    2. 在Action中动态生成配置文件:在Action步骤中添加初始化命令,生成所需配置文件后再执行lint:
      postman api init --api-id "你的API ID" --workspace-id "你的工作区ID"
      
      替换为你实际的API ID和工作区ID即可。
    3. 回退到稳定版本:如果不想适配新版本逻辑,可指定安装之前能正常运行的Postman CLI版本:
      curl -o- "https://dl-cli.pstmn.io/install/linux64.sh" | sh -s v10.17.0
      
      替换成你之前使用的具体版本号。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.18 04:50:03