Create a deployment: POST to '/repos/{owner}/{repo}/deployments' with body fields 'ref' (SHA, branch, or tag), 'environment' (e.g. 'production'), 'auto_merge: false', and 'required_contexts: []' to skip status checks if needed
Record the 'id' from the response; then POST to '/repos/{owner}/{repo}/deployments/{deployment_id}/statuses' with 'state' set to 'in_progress', 'log_url', and 'environment_url'
After the deploy finishes, POST another status with 'state' of 'success' or 'failure' and an optional 'description' for the GitHub UI
Configure environment protection rules (required reviewers, wait timers) in repo Settings > Environments so that deployments to protected environments require approval before proceeding
Query active deployments via GET '/repos/{owner}/{repo}/deployments?environment=production' and their latest statuses via GET '/repos/{owner}/{repo}/deployments/{id}/statuses'
Known gotchas
The 'transient_environment' and 'production_environment' boolean fields affect how GitHub displays and cleans up environments; omitting them defaults to non-transient non-production
Deployment statuses have a fixed set of valid 'state' values: 'error', 'failure', 'inactive', 'in_progress', 'queued', 'pending', 'success'; any other value returns a 422
GitHub does not automatically deactivate old deployments; explicitly set previous deployment statuses to 'inactive' to keep the environment view clean
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp