Contributing
=====

### You are the one responsible for the issue throughout its whole lifecycle, from assignment to delivery

1. take the first case that is assigned to you from the current sprint Github project

2. branches:
  * name convention: `issue_number-dasherized-issue-title` **(ex. #231 Events & Notifications architecture -> 231-events-and-notifications-infrastructure)**
  * branch from `master` (unless otherwise specified)
  * keep the branch up to date with the master branch (either rebase or merge master in your working branch)

3. pull requests:
  * in order for the CI build to run, your branch needs a pull request (circle CI will also pick up draft pull-requests)
  * create the pull-request towards the `master` branch (or the branch you started from) using Github UI. **The name of the pull request should be the same as the issue**
  * you can convert the issue to a pull-request using [hub](https://github.com/github/hub) | brew install hub (explained in more detail below)

4. ask for a code review:
  * once the issue is implemented and the CI build is passing ask one of your peers for a code review. Add the `review-me` label
  * if the implementation is more involved the code review should include a quick manual test by the reviewer

5. the reviewer either approves or requests changes. If changes are requested, the pull-request will get a `wip` label

6. implement the requested changes, make sure the CI build is passing, remove the `wip` label and add back the `review-me` label to pull-request

7. when the reviewer(s) approve the pull-request, the CI/CD pipeline will deploy it to staging then production.
8. after the issue when to production your work is done so give yourself a pat on the back. Nice work! Now go to step 1 :)

#### Using Github Hub to convert issues to pull-requests

* A little-known-feature of the GitHub API is the ability to attach changes to an issue, converting it into a pull request. The [hub](https://github.com/github/hub) command is a wrapper around git that makes it more GitHub aware and allows you to easily do this.

* command: `hub pull-request -i 231 -b blinksale:master -h blinksale:231-events-and-notifications-infrastructure`
  * `-i` is the GitHub issue number
  * `-b` is the base, or where you want to send the pull request, with `blinksale` being the owner of the repository
  * `-h` is the head, or the branch where your changes live.
  * `-d` use this flag to create a draft pull-request

* as long as you've pushed your changes and your local branch is tracking your remote you can exclude the `-b` and `-h`options

* example: you are locally on the `231-events-and-notifications-infrastructure` which is tracking your remote. To convert issue #231 to a pull request you would simply do `hub pull-request -i 231`
