Get Postman Native Git workflows running in your project.
- Node.js v16+
- Git v2.x+
- Postman account — postman.com
Option A — Use this repo as a template
git clone https://github.com/your-org/postman-native-git-cookbook.git
cd postman-native-git-cookbook
npm installOption B — Add to an existing project
cd your-project
npm install --save-dev husky lint-staged @stoplight/spectral-cli postman-cli
npx husky install
npm pkg set scripts.prepare="husky install"
mkdir -p .husky# Install (global or project)
npm install -g postman-cli
# or: npm install --save-dev postman-cli
# Verify
postman --version
# Log in (interactive or API key for CI)
postman login
# or: postman login --with-api-key YOUR_API_KEY
# Check
postman whoamiGet an API key: Postman API keys
Husky runs checks before each commit. Configure in .husky/pre-commit and package.json (lint-staged). See COMMIT_HOOKS.md and .husky/pre-commit-examples.sh for patterns.
Minimal pre-commit idea: run npx lint-staged, then if postman/ files are staged, run npm run lint:collections (and optionally npm run test:api).
- Collections:
npm run lint:collections(uses.spectral.yamland.spectral/lint-with-names.js) - OpenAPI specs:
npm run lint:specs(uses.spectral-openapi.yaml)
See SPECTRAL.md for rule details and custom rules.
Use the workflows under .github/workflows/ and follow CI_CD.md. Add POSTMAN_API_KEY to GitHub Settings → Secrets and variables → Actions.
npm run prepare # Install hooks
npm run lint:collections # Lint collections
postman collection run postman/collections/your-collection.postman_collection.json # Run a collectionPush to trigger CI and check the Actions tab.
| Problem | Fix |
|---|---|
| Pre-commit not running | npm run prepare; chmod +x .husky/pre-commit |
postman: command not found |
Use npx postman-cli or ensure install path is in PATH |
| Authentication failed | postman login or postman login --with-api-key KEY; check key at postman.com |
| Spectral errors | Ensure .spectral.yaml exists; run npx @stoplight/spectral-cli --version |
| CI fails, local passes | Check POSTMAN_API_KEY secret; add a wait/health check before running collections |
- COMMIT_HOOKS.md — Hook behavior and examples
- CI_CD.md — GitHub Actions
- SPECTRAL.md — Linting
- README — Full cookbook