# Wiplock - Protect main branch from in-progress branches

*2016-09-23*

> I released Wiplock that protects main branch from pull requests that contains WIP in the title or incompleted tasks.

![](screen.gif)

## TL;DR

I released [Wiplock] that protects main branch from pull requests that contains `WIP` in the title or incompleted tasks.

https://wiplock.com

Wiplock is an OSS built with Go and React + Redux. Please take a look if you're interested in.

https://github.com/ngs/wiplock

<!--more-->

## Motivation

In our daily development flow, we send **WIP pull requests** on GitHub before implementation was done.

Sometimes we mistakenly merge these pull requests before the tasks are completed or forget removing `WIP` in the title that may confuse collaborators.

To prevent these kind of mis-operations, I've built an tiny web application called Wiplock.

## How it works

### 1. Sign in with GitHub

After visiting [Wiplock], you'll see the black _Sign in with GitHub_ button.

Hit it and Authorize this app on the next screen.

Make sure that organizations are granted that you want introducing Wiplock.

### 2. Find repository and turn the switch on

![](switch.gif)

After you signed in with GitHub, your repositories will be listed in Wiplock.

Find repositories to introduce and turn the switch on.

### 3. Check that works

![](pending-status.png)

Go to your repository and edit or create pull request to contain `WIP` in the title.

Once you edit the title, Pull Request status would become _Pending_.

### 4. Turn on protect branch

![](protect-branch.png)

Go to `Settings > Branches` of your repo, turn _Require branches to be up to date before merging_ checkbox on.

## Launch your own Wiplock

If you won't like to give permission to applications managed by someone else, you can launch your own Wiplock on Heroku or Docker hosts.

### Pre-requirements

You need to create your OAuth Application on GitHub.

https://github.com/settings/applications/new

### Heroku

Just hit the Heroku Button on README of the repository.

https://github.com/ngs/wiplock#heroku

### Docker

Redis server is required to launch on your host.

If you don't have it yet, the Official Docker image will help you bootstrapping.

```sh
docker pull redis
docker run --name wiplock-redis -d redis
```

Pull Wiplock Docker image.

```sh
docker pull atsnngs/wiplock
```

And run Wiplock by passing `REDIS_URL` with running container name.

```sh
docker run --name wiplock -p 8000:8000 -d --rm \
  --link wiplock-redis:redis \
  -e GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID} \
  -e GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET} \
  -e SECRET=${SECRET} \
  -e REDIS_URL="redis://redis:6379" \
  atsnngs/wiplock
```

Then you can see your Wiplock on your localhost.

http://localhost:8000

## Milestones

- Support locking pull requests labeled `in progress`
- Support customizing locking conditions using `.wiplock.yml` on the repository root

I wish this could help your workflow safe, happy locking!

[wiplock]: https://wiplock.com


