Better Practices

For individual engineers to the largest teams, Better Practices is intended to distill knowledge from the Postman community. This is a place to learn about modern software practices together! Read more: https://medium.com/better-practices/introducing-better-practices-e9cf14cf0c88

Elevate your automation game by using Git Hooks

Matt Ball
Better Practices
Published in
6 min readAug 15, 2019

--

Photo by Efe Kurnaz on Unsplash

Getting started 🛠

#!/usr/bin/env nodeconsole.log('Hello world!')
Testing a basic “Hello world!” post-checkout Git Hook

Making things more sophisticated ⚙

Manual workflow

Manual vs. Automated workflow with Git Hooks. Manual interactions in gray.

Automated workflow

module.exports = {
postmanApiKey: 'xxx',
collectionFile: 'postman_collection.json'
}
post-checkout hook syncs repo based collection with Postman workspace
Automatically creating a Postman collection on a git checkout command
pre-push hook syncs changed made in Postman with local branch
Automatically commit an updated Postman collection to our branch (see highlight)
Pull request with our changed files as well as the synced collection file

Summary 🛤

Photo by SpaceX on Unsplash

--

--

Better Practices
Better Practices

Published in Better Practices

For individual engineers to the largest teams, Better Practices is intended to distill knowledge from the Postman community. This is a place to learn about modern software practices together! Read more: https://medium.com/better-practices/introducing-better-practices-e9cf14cf0c88

Matt Ball
Matt Ball

Written by Matt Ball

🇬🇧 living in 🇺🇸. Doing solutionsy things. Wannabe racing driver. https://matt-ball.uk

Responses (2)