{"action":"created","issue":{"url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation/issues/94","labels_url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation/issues/94/labels{/name}","comments_url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation/issues/94/comments","events_url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation/issues/94/events","html_url":"https://github.com/swcarpentry/python-novice-inflammation/issues/94","id":74970495,"number":94,"title":"Make a script to update python-novice-inflammation.zip","user":{"login":"tbekolay","id":203709,"avatar_url":"https://avatars.githubusercontent.com/u/203709?v=3","gravatar_id":"","url":"https://api.github.com/users/tbekolay","html_url":"https://github.com/tbekolay","followers_url":"https://api.github.com/users/tbekolay/followers","following_url":"https://api.github.com/users/tbekolay/following{/other_user}","gists_url":"https://api.github.com/users/tbekolay/gists{/gist_id}","starred_url":"https://api.github.com/users/tbekolay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbekolay/subscriptions","organizations_url":"https://api.github.com/users/tbekolay/orgs","repos_url":"https://api.github.com/users/tbekolay/repos","events_url":"https://api.github.com/users/tbekolay/events{/privacy}","received_events_url":"https://api.github.com/users/tbekolay/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation/labels/enhancement","name":"enhancement","color":"E0115F"},{"url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation/labels/newcomer-friendly","name":"newcomer-friendly","color":"FCE883"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-05-10T18:18:11Z","updated_at":"2015-05-26T22:17:11Z","closed_at":null,"body":"We have a zip file in the main directory to make it easy to get access to the necessary files used in the lesson. There's repetition here, but not repetition that we can avoid for pragmatic reasons. But, we should make sure that this zip always contains the right versions of the right files, so it would be helpful to have a little Python or Bash script that either checks that this zip is correct, or perhaps ideally, creates the appropriate zip file (which should be identical to the existing zip file if the files in it are the same)."},"comment":{"url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation/issues/comments/105685517","html_url":"https://github.com/swcarpentry/python-novice-inflammation/issues/94#issuecomment-105685517","issue_url":"https://api.github.com/repos/swcarpentry/python-novice-inflammation/issues/94","id":105685517,"user":{"login":"richford","id":7978135,"avatar_url":"https://avatars.githubusercontent.com/u/7978135?v=3","gravatar_id":"","url":"https://api.github.com/users/richford","html_url":"https://github.com/richford","followers_url":"https://api.github.com/users/richford/followers","following_url":"https://api.github.com/users/richford/following{/other_user}","gists_url":"https://api.github.com/users/richford/gists{/gist_id}","starred_url":"https://api.github.com/users/richford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richford/subscriptions","organizations_url":"https://api.github.com/users/richford/orgs","repos_url":"https://api.github.com/users/richford/repos","events_url":"https://api.github.com/users/richford/events{/privacy}","received_events_url":"https://api.github.com/users/richford/received_events","type":"User","site_admin":false},"created_at":"2015-05-26T22:17:11Z","updated_at":"2015-05-26T22:17:11Z","body":"For that matter, would the maintainers (@tbekolay and @abostroem) like `make preview` to be put in a client-side hook of some sort. My first reaction was that if you are going through the trouble of typing `make preview` before you commit, then it makes sense to just add the zip commands in my comment above to the makefile.\r\n\r\nI can certainly submit a PR adding the zip commands to the makefile. Would that be done for [python-novice-inflammation](https://github.com/swcarpentry/python-novice-inflammation) or for [lesson-template](https://github.com/swcarpentry/lesson-template)? If it went in lesson-template, it seems that everyone would have to agree on the same zip file name (e.g. `lesson-data.zip`).\r\n\r\nBut this got me thinking: why go through the trouble of typing make preview at all? It seems like the lesson change workflow goes something like this:\r\n\r\n1. Someone makes a change to a lesson and submits a pull request.\r\n2. After approval, one of the lesson maintainers merges this request and commits the merge.\r\n3. The lesson maintainer then regenerates HTML and does another commit for that.\r\n\r\nI think we could use hooks to get rid of step 3 above. The solution (borrowed from [this thread](https://stackoverflow.com/questions/3284292/can-a-git-hook-automatically-add-files-to-the-commit)) could look something like\r\n\r\n- Add `.commit` to `.gitignore`.\r\n- Add a pre-commit hook to indicate that a commit is taking place (this will make sense after viewing the post-commit hook):\r\n\r\n```bash\r\n#!/bin/sh\r\ntouch .commit\r\n```\r\n\r\n- Then add a post-commit hook. If `.commit` exists then we know a commit just happened but the post-commit script hasn't run yet. We can use this to regenerate HTML files to the commit, and amend the last commit.\r\n\r\n```bash\r\n#!/bin/sh\r\nif [ -f .commit ]\r\n    then\r\n    rm -f .commit\r\n    make preview\r\n    git add -u *.html\r\n    # Amend previous commit using same message\r\n    # Use --no-verify to bypass pre-commit hook so that we don't get caught in a loop\r\n    git commit --amend -C HEAD --no-verify\r\nfi\r\n```\r\n\r\nWe could also use `-c` instead of `-C` to edit the commit message to add that we are regenerating html. Either way, we're left with only steps 1 and 2 from above.\r\n\r\nI'm fairly new to SWC and don't really know anything about the maintainer workflow, so my apologies if this isn't a useful suggestion. What do you think? And should this be moved to the lesson-template repo? I'm not really sure if/how the lesson repositories talk to each other."}}