guides-cms
guides-cms copied to clipboard
Support adding a branch via github push webhook
Currently we remove branches from the details.json metadata file when a branch is deleted via github. This is done via the delete webhook. We should also hook into adding a branch via the push event.
We're already handling the push web hook, but we're only using it to clear our guide cache.
This would be useful in a few scenarios:
- The 'restore branch' button in the Github.com UI.
- Sometimes editors might delete a branch on accident. The delete will trigger the branch to be removed from the associated
details.jsonfile. However, hitting the 'restore a branch' will not re-add it to thedetails.jsonfile. - The net effect of this is that our site will never show a link to this branch again unless we manually edit the metadata file or the user makes another edit to the original guide from our site.
- Sometimes editors might delete a branch on accident. The delete will trigger the branch to be removed from the associated
- Collaborator pushes a new branch and forgets to update the guide's
details.jsonfile.- Supporting this would make it very easy to support workflows where editors could do everything from the CLI and then just push a new branch to github.com. They wouldn't even need to edit the
details.jsonfile at all since the push event would detect a new branch and make the update automatically.
- Supporting this would make it very easy to support workflows where editors could do everything from the CLI and then just push a new branch to github.com. They wouldn't even need to edit the
Now that I think about it, adding this functionality would go a long way towards supporting #9.
Adding this doesn't solve the issue of user verification because only github collaborators could push a new branch from the CLI. However, it would make it easier on collaborators (and our eventual script) to not require editing of the details.json file.