{"action":"created","comment":{"url":"https://api.github.com/repos/tldr-pages/tldr/pulls/comments/46633544","id":46633544,"diff_hunk":"@@ -0,0 +1,61 @@\n+#!/usr/bin/env bash\n+\n+set -ev\n+\n+function initialize {\n+  if [ -z \"$TLDRHOME\" ]; then\n+    export TLDRHOME=${TRAVIS_BUILD_DIR:-`pwd`}\n+  fi\n+  export TLDR_ARCHIVE=\"tldr.zip\"\n+  export SITE_HOME=\"$HOME/site\"\n+  export SITE_URL=\"github.com/tldr-pages/tldr-pages.github.io\"\n+\n+  git config --global user.email \"travis@travis-ci.org\"\n+  git config --global user.name \"Travis CI\"\n+  git config --global push.default simple\n+  git config --global diff.zip.textconv \"unzip -c -a\"\n+}\n+\n+function rebuild_index {\n+  $TLDRHOME/scripts/build_index.rb\n+  echo \"Rebuilding index is done\"\n+}\n+\n+function build_archive {\n+  echo \"Removing $TLDR_ARCHIVE if it exists\"\n+  rm -f $TLDR_ARCHIVE || true\n+\n+  echo \"Creating an archive $TLDR_ARCHIVE\"\n+  cd $TLDRHOME/\n+  zip -r $TLDR_ARCHIVE pages/ LICENSE.md\n+}\n+\n+function upload_assets {\n+  echo \"Uploading assets to static site\"\n+\n+  git clone --quiet --depth 1 https://${GH_TOKEN}@${SITE_URL} $SITE_HOME\n+  mv -f $TLDR_ARCHIVE $SITE_HOME/assets/\n+  cp -f $TLDRHOME/pages/index.json $SITE_HOME/assets/\n+\n+  cd $SITE_HOME\n+  git add -A .\n+  git commit -m \"[TravisCI] uploaded assets after commits ${TRAVIS_COMMIT_RANGE}\"\n+  git push -q > /dev/null\n+\n+  echo \"Assets deployed\"\n+}\n+\n+###################################\n+# BEGINNING\n+###################################\n+\n+if [ ! \"$TRAVIS_PULL_REQUEST\" == \"false\" ]; then\n+  echo \"This is a Pull Request, no index rebuild needed\"\n+elif [ ! \"$TRAVIS_BRANCH\" == \"master\" ]; then\n+  echo \"This is not a master branch, no index rebuild needed\"\n+else","path":"scripts/build.sh","position":56,"original_position":56,"commit_id":"8b6b038d17cc193226ba745219ef3325fbd9f801","original_commit_id":"8b6b038d17cc193226ba745219ef3325fbd9f801","user":{"login":"igorshubovych","id":93907,"avatar_url":"https://avatars.githubusercontent.com/u/93907?v=3","gravatar_id":"","url":"https://api.github.com/users/igorshubovych","html_url":"https://github.com/igorshubovych","followers_url":"https://api.github.com/users/igorshubovych/followers","following_url":"https://api.github.com/users/igorshubovych/following{/other_user}","gists_url":"https://api.github.com/users/igorshubovych/gists{/gist_id}","starred_url":"https://api.github.com/users/igorshubovych/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorshubovych/subscriptions","organizations_url":"https://api.github.com/users/igorshubovych/orgs","repos_url":"https://api.github.com/users/igorshubovych/repos","events_url":"https://api.github.com/users/igorshubovych/events{/privacy}","received_events_url":"https://api.github.com/users/igorshubovych/received_events","type":"User","site_admin":false},"body":"The build is run everywhere (just to run linting) and then it uploads zip only when it on master.\r\n\r\nI had this check first on .travis.yml. But it was long ugly oneliner, which was hard to support and add more conditions.\r\nNow Travis always unconditionally run build.sh, which does all the checks. I saw both approaches in tutorials, both seems to be ok.","created_at":"2015-12-04T00:22:04Z","updated_at":"2015-12-04T00:22:04Z","html_url":"https://github.com/tldr-pages/tldr/pull/341#discussion_r46633544","pull_request_url":"https://api.github.com/repos/tldr-pages/tldr/pulls/341","_links":{"self":{"href":"https://api.github.com/repos/tldr-pages/tldr/pulls/comments/46633544"},"html":{"href":"https://github.com/tldr-pages/tldr/pull/341#discussion_r46633544"},"pull_request":{"href":"https://api.github.com/repos/tldr-pages/tldr/pulls/341"}}},"pull_request":{"url":"https://api.github.com/repos/tldr-pages/tldr/pulls/341","id":52599007,"html_url":"https://github.com/tldr-pages/tldr/pull/341","diff_url":"https://github.com/tldr-pages/tldr/pull/341.diff","patch_url":"https://github.com/tldr-pages/tldr/pull/341.patch","issue_url":"https://api.github.com/repos/tldr-pages/tldr/issues/341","number":341,"state":"open","locked":false,"title":"Travis CI integration: automatic linting, rebuilding index.json, building pages archive","user":{"login":"igorshubovych","id":93907,"avatar_url":"https://avatars.githubusercontent.com/u/93907?v=3","gravatar_id":"","url":"https://api.github.com/users/igorshubovych","html_url":"https://github.com/igorshubovych","followers_url":"https://api.github.com/users/igorshubovych/followers","following_url":"https://api.github.com/users/igorshubovych/following{/other_user}","gists_url":"https://api.github.com/users/igorshubovych/gists{/gist_id}","starred_url":"https://api.github.com/users/igorshubovych/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorshubovych/subscriptions","organizations_url":"https://api.github.com/users/igorshubovych/orgs","repos_url":"https://api.github.com/users/igorshubovych/repos","events_url":"https://api.github.com/users/igorshubovych/events{/privacy}","received_events_url":"https://api.github.com/users/igorshubovych/received_events","type":"User","site_admin":false},"body":"To learn more about the purpose of this PR, please see long discussion here - #336.\r\n\r\nThe main part of these commits are:\r\n\r\n- configuration file for Travis CI - `.travis.yml`\r\n- `scripts/build.sh` script\r\n\r\nThese scripts all together do the following:\r\n\r\n1. On all the branches run the tests (linting all files with `mdl`)\r\n2. If on master branch then it deploys pages archive\r\n3. To build pages archive, it first rebuilds pages index from scratch using scripts/build_index.rb\r\n4. Then it git clone static site\r\n5. Then it git it overwrites existing pages archive and index with the rebuilt ones.\r\n6. Finally it pushes static site with Travis CI tag in it.\r\n\r\nYou can see results here:\r\nhttps://github.com/tldr-pages/tldr-pages.github.io/commits/master\r\n\r\nNote. Unfortunately I squashed commits not perfect, so there are later commits.","created_at":"2015-12-03T21:59:16Z","updated_at":"2015-12-04T00:22:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"64b20b4661992a30e87622f519bfcdbe8e71e62d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tldr-pages/tldr/pulls/341/commits","review_comments_url":"https://api.github.com/repos/tldr-pages/tldr/pulls/341/comments","review_comment_url":"https://api.github.com/repos/tldr-pages/tldr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tldr-pages/tldr/issues/341/comments","statuses_url":"https://api.github.com/repos/tldr-pages/tldr/statuses/8b6b038d17cc193226ba745219ef3325fbd9f801","head":{"label":"igorshubovych:master","ref":"master","sha":"8b6b038d17cc193226ba745219ef3325fbd9f801","user":{"login":"igorshubovych","id":93907,"avatar_url":"https://avatars.githubusercontent.com/u/93907?v=3","gravatar_id":"","url":"https://api.github.com/users/igorshubovych","html_url":"https://github.com/igorshubovych","followers_url":"https://api.github.com/users/igorshubovych/followers","following_url":"https://api.github.com/users/igorshubovych/following{/other_user}","gists_url":"https://api.github.com/users/igorshubovych/gists{/gist_id}","starred_url":"https://api.github.com/users/igorshubovych/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorshubovych/subscriptions","organizations_url":"https://api.github.com/users/igorshubovych/orgs","repos_url":"https://api.github.com/users/igorshubovych/repos","events_url":"https://api.github.com/users/igorshubovych/events{/privacy}","received_events_url":"https://api.github.com/users/igorshubovych/received_events","type":"User","site_admin":false},"repo":{"id":46668134,"name":"tldr","full_name":"igorshubovych/tldr","owner":{"login":"igorshubovych","id":93907,"avatar_url":"https://avatars.githubusercontent.com/u/93907?v=3","gravatar_id":"","url":"https://api.github.com/users/igorshubovych","html_url":"https://github.com/igorshubovych","followers_url":"https://api.github.com/users/igorshubovych/followers","following_url":"https://api.github.com/users/igorshubovych/following{/other_user}","gists_url":"https://api.github.com/users/igorshubovych/gists{/gist_id}","starred_url":"https://api.github.com/users/igorshubovych/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorshubovych/subscriptions","organizations_url":"https://api.github.com/users/igorshubovych/orgs","repos_url":"https://api.github.com/users/igorshubovych/repos","events_url":"https://api.github.com/users/igorshubovych/events{/privacy}","received_events_url":"https://api.github.com/users/igorshubovych/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/igorshubovych/tldr","description":"Simplified and community-driven man pages","fork":true,"url":"https://api.github.com/repos/igorshubovych/tldr","forks_url":"https://api.github.com/repos/igorshubovych/tldr/forks","keys_url":"https://api.github.com/repos/igorshubovych/tldr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/igorshubovych/tldr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/igorshubovych/tldr/teams","hooks_url":"https://api.github.com/repos/igorshubovych/tldr/hooks","issue_events_url":"https://api.github.com/repos/igorshubovych/tldr/issues/events{/number}","events_url":"https://api.github.com/repos/igorshubovych/tldr/events","assignees_url":"https://api.github.com/repos/igorshubovych/tldr/assignees{/user}","branches_url":"https://api.github.com/repos/igorshubovych/tldr/branches{/branch}","tags_url":"https://api.github.com/repos/igorshubovych/tldr/tags","blobs_url":"https://api.github.com/repos/igorshubovych/tldr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/igorshubovych/tldr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/igorshubovych/tldr/git/refs{/sha}","trees_url":"https://api.github.com/repos/igorshubovych/tldr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/igorshubovych/tldr/statuses/{sha}","languages_url":"https://api.github.com/repos/igorshubovych/tldr/languages","stargazers_url":"https://api.github.com/repos/igorshubovych/tldr/stargazers","contributors_url":"https://api.github.com/repos/igorshubovych/tldr/contributors","subscribers_url":"https://api.github.com/repos/igorshubovych/tldr/subscribers","subscription_url":"https://api.github.com/repos/igorshubovych/tldr/subscription","commits_url":"https://api.github.com/repos/igorshubovych/tldr/commits{/sha}","git_commits_url":"https://api.github.com/repos/igorshubovych/tldr/git/commits{/sha}","comments_url":"https://api.github.com/repos/igorshubovych/tldr/comments{/number}","issue_comment_url":"https://api.github.com/repos/igorshubovych/tldr/issues/comments{/number}","contents_url":"https://api.github.com/repos/igorshubovych/tldr/contents/{+path}","compare_url":"https://api.github.com/repos/igorshubovych/tldr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/igorshubovych/tldr/merges","archive_url":"https://api.github.com/repos/igorshubovych/tldr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/igorshubovych/tldr/downloads","issues_url":"https://api.github.com/repos/igorshubovych/tldr/issues{/number}","pulls_url":"https://api.github.com/repos/igorshubovych/tldr/pulls{/number}","milestones_url":"https://api.github.com/repos/igorshubovych/tldr/milestones{/number}","notifications_url":"https://api.github.com/repos/igorshubovych/tldr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/igorshubovych/tldr/labels{/name}","releases_url":"https://api.github.com/repos/igorshubovych/tldr/releases{/id}","created_at":"2015-11-22T16:10:18Z","updated_at":"2015-12-02T00:18:49Z","pushed_at":"2015-12-03T21:41:59Z","git_url":"git://github.com/igorshubovych/tldr.git","ssh_url":"git@github.com:igorshubovych/tldr.git","clone_url":"https://github.com/igorshubovych/tldr.git","svn_url":"https://github.com/igorshubovych/tldr","homepage":null,"size":384,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tldr-pages:master","ref":"master","sha":"f877d1598962fd9452db243511adf9e5bc73f8e1","user":{"login":"tldr-pages","id":7366472,"avatar_url":"https://avatars.githubusercontent.com/u/7366472?v=3","gravatar_id":"","url":"https://api.github.com/users/tldr-pages","html_url":"https://github.com/tldr-pages","followers_url":"https://api.github.com/users/tldr-pages/followers","following_url":"https://api.github.com/users/tldr-pages/following{/other_user}","gists_url":"https://api.github.com/users/tldr-pages/gists{/gist_id}","starred_url":"https://api.github.com/users/tldr-pages/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tldr-pages/subscriptions","organizations_url":"https://api.github.com/users/tldr-pages/orgs","repos_url":"https://api.github.com/users/tldr-pages/repos","events_url":"https://api.github.com/users/tldr-pages/events{/privacy}","received_events_url":"https://api.github.com/users/tldr-pages/received_events","type":"Organization","site_admin":false},"repo":{"id":15019962,"name":"tldr","full_name":"tldr-pages/tldr","owner":{"login":"tldr-pages","id":7366472,"avatar_url":"https://avatars.githubusercontent.com/u/7366472?v=3","gravatar_id":"","url":"https://api.github.com/users/tldr-pages","html_url":"https://github.com/tldr-pages","followers_url":"https://api.github.com/users/tldr-pages/followers","following_url":"https://api.github.com/users/tldr-pages/following{/other_user}","gists_url":"https://api.github.com/users/tldr-pages/gists{/gist_id}","starred_url":"https://api.github.com/users/tldr-pages/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tldr-pages/subscriptions","organizations_url":"https://api.github.com/users/tldr-pages/orgs","repos_url":"https://api.github.com/users/tldr-pages/repos","events_url":"https://api.github.com/users/tldr-pages/events{/privacy}","received_events_url":"https://api.github.com/users/tldr-pages/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tldr-pages/tldr","description":"Simplified and community-driven man pages","fork":false,"url":"https://api.github.com/repos/tldr-pages/tldr","forks_url":"https://api.github.com/repos/tldr-pages/tldr/forks","keys_url":"https://api.github.com/repos/tldr-pages/tldr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tldr-pages/tldr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tldr-pages/tldr/teams","hooks_url":"https://api.github.com/repos/tldr-pages/tldr/hooks","issue_events_url":"https://api.github.com/repos/tldr-pages/tldr/issues/events{/number}","events_url":"https://api.github.com/repos/tldr-pages/tldr/events","assignees_url":"https://api.github.com/repos/tldr-pages/tldr/assignees{/user}","branches_url":"https://api.github.com/repos/tldr-pages/tldr/branches{/branch}","tags_url":"https://api.github.com/repos/tldr-pages/tldr/tags","blobs_url":"https://api.github.com/repos/tldr-pages/tldr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tldr-pages/tldr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tldr-pages/tldr/git/refs{/sha}","trees_url":"https://api.github.com/repos/tldr-pages/tldr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tldr-pages/tldr/statuses/{sha}","languages_url":"https://api.github.com/repos/tldr-pages/tldr/languages","stargazers_url":"https://api.github.com/repos/tldr-pages/tldr/stargazers","contributors_url":"https://api.github.com/repos/tldr-pages/tldr/contributors","subscribers_url":"https://api.github.com/repos/tldr-pages/tldr/subscribers","subscription_url":"https://api.github.com/repos/tldr-pages/tldr/subscription","commits_url":"https://api.github.com/repos/tldr-pages/tldr/commits{/sha}","git_commits_url":"https://api.github.com/repos/tldr-pages/tldr/git/commits{/sha}","comments_url":"https://api.github.com/repos/tldr-pages/tldr/comments{/number}","issue_comment_url":"https://api.github.com/repos/tldr-pages/tldr/issues/comments{/number}","contents_url":"https://api.github.com/repos/tldr-pages/tldr/contents/{+path}","compare_url":"https://api.github.com/repos/tldr-pages/tldr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tldr-pages/tldr/merges","archive_url":"https://api.github.com/repos/tldr-pages/tldr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tldr-pages/tldr/downloads","issues_url":"https://api.github.com/repos/tldr-pages/tldr/issues{/number}","pulls_url":"https://api.github.com/repos/tldr-pages/tldr/pulls{/number}","milestones_url":"https://api.github.com/repos/tldr-pages/tldr/milestones{/number}","notifications_url":"https://api.github.com/repos/tldr-pages/tldr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tldr-pages/tldr/labels{/name}","releases_url":"https://api.github.com/repos/tldr-pages/tldr/releases{/id}","created_at":"2013-12-08T07:34:43Z","updated_at":"2015-12-03T15:57:04Z","pushed_at":"2015-12-03T21:59:16Z","git_url":"git://github.com/tldr-pages/tldr.git","ssh_url":"git@github.com:tldr-pages/tldr.git","clone_url":"https://github.com/tldr-pages/tldr.git","svn_url":"https://github.com/tldr-pages/tldr","homepage":"http://tldr-pages.github.io/","size":676,"stargazers_count":2015,"watchers_count":2015,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":160,"mirror_url":null,"open_issues_count":29,"forks":160,"open_issues":29,"watchers":2015,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tldr-pages/tldr/pulls/341"},"html":{"href":"https://github.com/tldr-pages/tldr/pull/341"},"issue":{"href":"https://api.github.com/repos/tldr-pages/tldr/issues/341"},"comments":{"href":"https://api.github.com/repos/tldr-pages/tldr/issues/341/comments"},"review_comments":{"href":"https://api.github.com/repos/tldr-pages/tldr/pulls/341/comments"},"review_comment":{"href":"https://api.github.com/repos/tldr-pages/tldr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tldr-pages/tldr/pulls/341/commits"},"statuses":{"href":"https://api.github.com/repos/tldr-pages/tldr/statuses/8b6b038d17cc193226ba745219ef3325fbd9f801"}}}}