konklone/konklone — pull request #125 by konklone (2014-04-06 02:27:36+00:00)
Title: Sync posts to Github

Any visible (published, non-private) posts are synced automatically to Github. They default to being synced to [konklone/writing](https://github.com/konklone/writing), in [/blog](https://github.com/konklone/writing/tree/master/blog).

Posts can be synced to any Github URL to which the app's token has read/write access to. By default, the first time a post is published, a default URL is assigned to it and the slug at publish-time is used to generate the URL. If a URL has been given before publishing, that URL is used instead.

Commit messages can be provided with the same field that was previously used to snap new versions internally (internal versioning will be removed in the near future). If a post is being published, the default commit message will reflect that it's the first published version, otherwise it'll be just an update.

Post now store 3 new fields:

* `github` - the URL of the file to sync to on github
* `github_last_message` - the "commit" message that was used for the post's last save
* `github_last_sha` - the SHA generated from the post's last save to Github

The `github_last_sha` field is being saved now, with the intent that it will be used to prevent infinite circular update loops when I add sync in the other direction (pull requests triggering webhooks to update my database).

/cc @parkr @benbalter since their last PR inspired me to finally get this kicked off.