Ci Integration

作者 postmanlabs67cff8f385d8無授權條款收錄於 2026年10月8日更新於 2026年10月8日

Common CI integrations that can added as independent pass/fail gates. Use when the user asks to "add Postman to CI," "run this collection on every PR," "fail the build on a governance violation," or "push to the postman cloud workspace after merge to main", "add some api related operation in my Github actions".

僅含說明DevOps & Cloud
AI 產生的概覽

將 Postman CLI 檢查以獨立的通過/失敗關卡加入 CI 流程。

功能
說明如何把 Postman CLI 指令接進 CI 工作流程並當作獨立關卡:執行集合、對規格、集合或工作區做 lint、檢查 AI 就緒分數,以及在合併後推送到 Postman 雲端工作區。內容涵蓋退出碼行為、報告輸出、以 API 金鑰驗證,以及哪些指令會套用組織治理規則。產出的是指引說明與範例工作流程片段,而非指令碼。
適用情境
當使用者想把 Postman 集合執行、lint、AI 就緒門檻或工作區推送加入 GitHub Actions 等 CI 流程時使用。也適合用來判斷哪個 Postman CLI 子指令對應所需的關卡,或如何以非互動方式驗證。
執行需求
需要 Postman CLI,以及透過 CI 供應商密鑰儲存提供的 Postman API 金鑰;需要連線至 Postman 服務的網路存取。僅為說明文件,未附指令碼。

CI Integration

Overview

These are some common workflows that one can add in their CI pipeline leveraging postman cli.

Run a collection — a gated pipeline step

postman collection run <path/id> exits nonzero on a failed pm.test assertion, which is what makes it a usable gate — see api-testing for how that exit code actually gets set. What's CI-specific: -r junit,html (or --reporter-*-export) writes a report your CI provider can surface as build artifacts or test annotations, instead of leaving the result buried in a log. --bail stops the run early on the first failure when a fast signal matters more than a full report.

Lint — pick the target that matches the gate you want

Three verbs look interchangeable and aren't — only two of them apply your organization's governance rules, and the CLI's own -h output is where that becomes visible (no assumption below goes further than what it printed):

Want to checkCommandApplies org governance?
One spec against your rulesspec lint <spec> --workspace-id <id> -f errorYes, via --workspace-id
One collection's structure/stylecollection lint <path> -f errorNo — this verb takes no --workspace-id at all
The whole workspace: every entity plus .postman/resources.yamlworkspace lint --workspace-id <id> -f errorYes

collection lint is a schema/style check only — running it and reporting "governance passed" overstates what it did. If the ask is "does this collection violate our rules," workspace lint is the one that actually answers it (and covers every collection in the repo in one pass); reach for bare collection lint only when there's no workspace to fetch rules from yet.

Push to workspace — only after merge

postman workspace push -y is the one command in this skill that changes shared cloud state, so it belongs behind a merge-to-main trigger, not a PR trigger. -y skips confirmation prompts a non-interactive job can't answer. Leave --no-prepare off — the default prepare step is what assigns real IDs to entities that are new since the last push; skipping it because a run felt slow trades a few seconds for a push that silently fails to create anything new.

--push-strategy force-sync mirrors the whole workspace, deleting any cloud entity with no local counterpart — genuinely destructive, and not the default for a reason. See Critical Rules before adding it to a merge job.

AI readiness threshold

collection ai-readiness <path> --min-score <n> and its spec-side counterpart spec ai-readiness <path> --min-score <n> (see ai-readiness skill) are a fourth, separate gate — they score AI-agent consumability, not test results or governance/structural style. Keep either in its own step: folding it into the same step as run or one of the lint verbs above hides which kind of check actually failed when the job goes red. Pick the verb that matches what's checked into the repo — collection ai-readiness for a git-synced collection, spec ai-readiness for an OpenAPI spec with no collection generated from it yet.

yaml
- run: postman collection ai-readiness ./postman/collections/My\ API --min-score 70

Critical Rules

  1. Never collapse run, lint, and ai-readiness into one step, and never pass -x/--suppress-exit-code to a CI run. One combined exit code hides which check broke; a suppressed one hides that anything broke at all.

  2. Gate workspace push to the merge event, never a PR event. Everything else in this skill is read-only against the cloud; this is the one command that writes to it, so a PR-triggered push ships an unmerged branch's entities to the shared workspace.

  3. --push-strategy force-sync deletes cloud entities absent locally. Only add it to a job whose explicit job is mirroring the workspace exactly, with that intent confirmed — never as the default merge step, where the default (create/update-only) strategy is the safe choice.

  4. Authenticate once, non-interactively: postman login --with-api-key "$POSTMAN_API_KEY", reading the key from the CI provider's secret store. Don't reach for collection run's --postman-api-key as the general answer — it's US-region only — and spec lint/workspace push don't take it at all.

    yaml
    # WRONG — key committed in plain text, and scoped to one command anyway- run: postman collection run api.json --postman-api-key PMAK-abc123...
    # CORRECT — one non-interactive login, key from the provider's secret store- run: postman login --with-api-key "$POSTMAN_API_KEY"- run: postman collection run api.json- run: postman spec lint spec.yaml --workspace-id $WS -f error
  5. Never newman run in place of postman collection run. The CLI is the supported runner every other skill here assumes; Newman forks the toolchain and skips whatever reporting/governance depends on the CLI specifically.

Verification

State each gate that ran and its individual result — not "CI passed," but which check ran, what it checked (governance vs. structure per the Lint table above, or AI-agent consumability for ai-readiness), and its exit code. If workspace push ran, confirm it was triggered by the merge event and not a PR event, state which push strategy was used, and report Created/Updated per entity rather than just "push succeeded." Confirm no secret value appears literally in the committed workflow file.

Reference

  • api-testing skill — collection run's exit-code semantics and reporter flags in full.
  • collection-schema-v3 skill — what workspace push is actually pushing.
  • bootstrap skill — CLI resolution, workspace linking, .postman/resources.yaml.
  • ai-readiness skill — collection ai-readiness, spec ai-readiness, and their --min-score gate.

來源與署名

來源:postmanlabs/postman-plugin位於skills/ci-integration提交67cff8f

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架

更多來自 postmanlabs/postman-plugin 的技能

Performance Testing

postmanlabs

以虛擬使用者、負載設定檔和通過/失敗門檻執行 Postman 集合負載測試。

Software Development2026年10月8日

Flows

postmanlabs

透過命令列操作 Postman Flows:列出、執行、觸發、部署、更新並偵錯流程及其執行紀錄。

DevOps & Cloud2026年10月8日

Api Testing

postmanlabs

Runs tests against an API from the command line — a single ad-hoc request, a full collection of pm.test assertions, or matching real captured app traffic against a collection contract. Use when the user asks to "test this endpoint," "run this collection," "check the API still works," or "verify my app's requests match the contract." Covers `postman request`, `postman collection run`, and `postman application test`. Depends on bootstrap when the target is a cloud collection or workspace-bound environment; a bare URL or local collection needs nothing from bootstrap.

待分類2026年10月8日

Api Monitoring

postmanlabs

Creates, schedules, and manages Postman Monitors — recurring checks against a live API — triggers ad hoc runs, inspects job/run history to diagnose failures, and hosts self-hosted execution runners for monitors on a private network. Use when the user asks to "set up a monitor," "run this monitor now," "check monitor results," "pause/resume a monitor," or "set up a runner for our internal APIs." Covers `postman monitor` (create, update, delete, list, get, pause, resume, run, jobs, runs) and `postman runner` (start, list, regions).

待分類2026年10月8日

Api Mocking

postmanlabs

在本機或雲端建立並執行模擬 API 後端,支援情境與狀態碼覆寫以便測試。

Software Development2026年10月8日

Api Engineer

postmanlabs

指導 API 工程工作,涵蓋契約設計、實作、模擬、測試、文件與部署。

Software Development2026年10月8日