{"action":"created","comment":{"url":"https://api.github.com/repos/thoughtbot/suspenders/pulls/comments/46703971","id":46703971,"diff_hunk":"@@ -34,6 +33,43 @@ def set_heroku_rails_secrets\n         end\n       end\n \n+      def provide_review_apps_setup_script\n+        app_builder.template(\n+          \"bin_setup_review_app.erb\",\n+          \"bin/setup_review_app\",\n+          force: true,\n+        )\n+        app_builder.run \"chmod a+x bin/setup_review_app\"\n+      end\n+\n+      def create_heroku_pipelines_config_file\n+        template \"app.json.erb\", \"app.json\"\n+      end\n+\n+      def create_heroku_pipeline\n+        heroku_app_name = app_name.dasherize\n+\n+        pipelines_plugin = `heroku plugins | grep pipelines`\n+        if pipelines_plugin.empty?\n+          puts 'You need heroku pipelines plugin. Run: heroku plugins:install heroku-pipelines'\n+          exit 1\n+        end\n+        app_builder.run_heroku(\n+          \"pipelines:create #{heroku_app_name} -a #{heroku_app_name}-staging --stage staging\",\n+          \"staging\",\n+        )\n+        app_builder.run_heroku(\n+          \"pipelines:add #{heroku_app_name} -a #{heroku_app_name}-production --stage production\",","path":"lib/suspenders/adapters/heroku.rb","position":42,"original_position":42,"commit_id":"b35c1f861e5ec66fcc86f69ffd97b88bc68fd43a","original_commit_id":"b35c1f861e5ec66fcc86f69ffd97b88bc68fd43a","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Line is too long. [97/80]","created_at":"2015-12-04T16:57:50Z","updated_at":"2015-12-04T16:57:50Z","html_url":"https://github.com/thoughtbot/suspenders/pull/639#discussion_r46703971","pull_request_url":"https://api.github.com/repos/thoughtbot/suspenders/pulls/639","_links":{"self":{"href":"https://api.github.com/repos/thoughtbot/suspenders/pulls/comments/46703971"},"html":{"href":"https://github.com/thoughtbot/suspenders/pull/639#discussion_r46703971"},"pull_request":{"href":"https://api.github.com/repos/thoughtbot/suspenders/pulls/639"}}},"pull_request":{"url":"https://api.github.com/repos/thoughtbot/suspenders/pulls/639","id":48629032,"html_url":"https://github.com/thoughtbot/suspenders/pull/639","diff_url":"https://github.com/thoughtbot/suspenders/pull/639.diff","patch_url":"https://github.com/thoughtbot/suspenders/pull/639.patch","issue_url":"https://api.github.com/repos/thoughtbot/suspenders/issues/639","number":639,"state":"open","locked":false,"title":"Introduce Heroku Pipelines support","user":{"login":"zamith","id":166304,"avatar_url":"https://avatars.githubusercontent.com/u/166304?v=3","gravatar_id":"","url":"https://api.github.com/users/zamith","html_url":"https://github.com/zamith","followers_url":"https://api.github.com/users/zamith/followers","following_url":"https://api.github.com/users/zamith/following{/other_user}","gists_url":"https://api.github.com/users/zamith/gists{/gist_id}","starred_url":"https://api.github.com/users/zamith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zamith/subscriptions","organizations_url":"https://api.github.com/users/zamith/orgs","repos_url":"https://api.github.com/users/zamith/repos","events_url":"https://api.github.com/users/zamith/events{/privacy}","received_events_url":"https://api.github.com/users/zamith/received_events","type":"User","site_admin":false},"body":"Why:\r\n\r\n* We have observed that running acceptance through Heroku Pipelines is a\r\n  better flow for code reviews, by allowing to show work in progress\r\n  earlier, and fixing issue before merging into master\r\n\r\nThis change addresses the need by:\r\n\r\n* Creating a pipeline for the new app, and adding the staging and\r\n  production environments to it\r\n* Adding a required `app.json` configuration file\r\n* Setting `Rack::CanonicalHost` only in staging and production, and not\r\n  review apps (otherwise review apps redirect to staging)\r\n* Adding a setup script for review apps to scale up workers to 1 and run migrations\r\n\r\n## Done\r\n\r\n- [x] Check if heroku pipelines plugin is installed\r\n```bash\r\nif heroku pipelines &> /dev/null; then\r\n  do_it\r\nelse\r\n  printf 'You need heroku pipelines plugin. Run: heroku plugins:install heroku-pipelines'\r\nfi\r\n```\r\n- [x] Fix `APPLICATION_HOST`: https://github.com/thoughtbot/suspenders/pull/639#issuecomment-152546822. If we do, we don't need a conditional around `Rack::CanonicalHost`.\r\n- [x] Emails are being sent with the staging URL, and so links don't work for review apps (related to previous point)\r\n- [x] Work around the fact that there are no after hooks after a review app is created, and we need to set up the database at first manually (`bin/setup_review_app`).\r\n- [x] Emails aren't send because review apps are not starting with a worker dyno (`bin/setup_review_app`)\r\n- [x] Add instructions for hooking up the pipeline to GitHub autodeploys in README\r\n  * needs to set up Circle CI with the new GitHub repo\r\n  * needs to hook up GitHub autodeploys in Heroku\r\n  * needs to hook up GitHub auto review apps in Heroku\r\n","created_at":"2015-10-23T20:55:23Z","updated_at":"2015-12-04T16:57:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2211331b51378a4f9adf6dc6ecd1db25fe2e9d6b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/thoughtbot/suspenders/pulls/639/commits","review_comments_url":"https://api.github.com/repos/thoughtbot/suspenders/pulls/639/comments","review_comment_url":"https://api.github.com/repos/thoughtbot/suspenders/pulls/comments{/number}","comments_url":"https://api.github.com/repos/thoughtbot/suspenders/issues/639/comments","statuses_url":"https://api.github.com/repos/thoughtbot/suspenders/statuses/b35c1f861e5ec66fcc86f69ffd97b88bc68fd43a","head":{"label":"zamith:heroku-pipelines","ref":"heroku-pipelines","sha":"b35c1f861e5ec66fcc86f69ffd97b88bc68fd43a","user":{"login":"zamith","id":166304,"avatar_url":"https://avatars.githubusercontent.com/u/166304?v=3","gravatar_id":"","url":"https://api.github.com/users/zamith","html_url":"https://github.com/zamith","followers_url":"https://api.github.com/users/zamith/followers","following_url":"https://api.github.com/users/zamith/following{/other_user}","gists_url":"https://api.github.com/users/zamith/gists{/gist_id}","starred_url":"https://api.github.com/users/zamith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zamith/subscriptions","organizations_url":"https://api.github.com/users/zamith/orgs","repos_url":"https://api.github.com/users/zamith/repos","events_url":"https://api.github.com/users/zamith/events{/privacy}","received_events_url":"https://api.github.com/users/zamith/received_events","type":"User","site_admin":false},"repo":{"id":44832733,"name":"suspenders","full_name":"zamith/suspenders","owner":{"login":"zamith","id":166304,"avatar_url":"https://avatars.githubusercontent.com/u/166304?v=3","gravatar_id":"","url":"https://api.github.com/users/zamith","html_url":"https://github.com/zamith","followers_url":"https://api.github.com/users/zamith/followers","following_url":"https://api.github.com/users/zamith/following{/other_user}","gists_url":"https://api.github.com/users/zamith/gists{/gist_id}","starred_url":"https://api.github.com/users/zamith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zamith/subscriptions","organizations_url":"https://api.github.com/users/zamith/orgs","repos_url":"https://api.github.com/users/zamith/repos","events_url":"https://api.github.com/users/zamith/events{/privacy}","received_events_url":"https://api.github.com/users/zamith/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zamith/suspenders","description":"A Rails template with our standard defaults, ready to deploy to Heroku.","fork":true,"url":"https://api.github.com/repos/zamith/suspenders","forks_url":"https://api.github.com/repos/zamith/suspenders/forks","keys_url":"https://api.github.com/repos/zamith/suspenders/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zamith/suspenders/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zamith/suspenders/teams","hooks_url":"https://api.github.com/repos/zamith/suspenders/hooks","issue_events_url":"https://api.github.com/repos/zamith/suspenders/issues/events{/number}","events_url":"https://api.github.com/repos/zamith/suspenders/events","assignees_url":"https://api.github.com/repos/zamith/suspenders/assignees{/user}","branches_url":"https://api.github.com/repos/zamith/suspenders/branches{/branch}","tags_url":"https://api.github.com/repos/zamith/suspenders/tags","blobs_url":"https://api.github.com/repos/zamith/suspenders/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zamith/suspenders/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zamith/suspenders/git/refs{/sha}","trees_url":"https://api.github.com/repos/zamith/suspenders/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zamith/suspenders/statuses/{sha}","languages_url":"https://api.github.com/repos/zamith/suspenders/languages","stargazers_url":"https://api.github.com/repos/zamith/suspenders/stargazers","contributors_url":"https://api.github.com/repos/zamith/suspenders/contributors","subscribers_url":"https://api.github.com/repos/zamith/suspenders/subscribers","subscription_url":"https://api.github.com/repos/zamith/suspenders/subscription","commits_url":"https://api.github.com/repos/zamith/suspenders/commits{/sha}","git_commits_url":"https://api.github.com/repos/zamith/suspenders/git/commits{/sha}","comments_url":"https://api.github.com/repos/zamith/suspenders/comments{/number}","issue_comment_url":"https://api.github.com/repos/zamith/suspenders/issues/comments{/number}","contents_url":"https://api.github.com/repos/zamith/suspenders/contents/{+path}","compare_url":"https://api.github.com/repos/zamith/suspenders/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zamith/suspenders/merges","archive_url":"https://api.github.com/repos/zamith/suspenders/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zamith/suspenders/downloads","issues_url":"https://api.github.com/repos/zamith/suspenders/issues{/number}","pulls_url":"https://api.github.com/repos/zamith/suspenders/pulls{/number}","milestones_url":"https://api.github.com/repos/zamith/suspenders/milestones{/number}","notifications_url":"https://api.github.com/repos/zamith/suspenders/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zamith/suspenders/labels{/name}","releases_url":"https://api.github.com/repos/zamith/suspenders/releases{/id}","created_at":"2015-10-23T19:02:43Z","updated_at":"2015-10-23T19:02:44Z","pushed_at":"2015-12-04T16:57:46Z","git_url":"git://github.com/zamith/suspenders.git","ssh_url":"git@github.com:zamith/suspenders.git","clone_url":"https://github.com/zamith/suspenders.git","svn_url":"https://github.com/zamith/suspenders","homepage":"https://thoughtbot.com/open-source","size":1007,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"thoughtbot:master","ref":"master","sha":"6508b6ad3c0640d87f701608a5cc6699988b5b9d","user":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?v=3","gravatar_id":"","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"repo":{"id":666566,"name":"suspenders","full_name":"thoughtbot/suspenders","owner":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?v=3","gravatar_id":"","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thoughtbot/suspenders","description":"A Rails template with our standard defaults, ready to deploy to Heroku.","fork":false,"url":"https://api.github.com/repos/thoughtbot/suspenders","forks_url":"https://api.github.com/repos/thoughtbot/suspenders/forks","keys_url":"https://api.github.com/repos/thoughtbot/suspenders/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thoughtbot/suspenders/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thoughtbot/suspenders/teams","hooks_url":"https://api.github.com/repos/thoughtbot/suspenders/hooks","issue_events_url":"https://api.github.com/repos/thoughtbot/suspenders/issues/events{/number}","events_url":"https://api.github.com/repos/thoughtbot/suspenders/events","assignees_url":"https://api.github.com/repos/thoughtbot/suspenders/assignees{/user}","branches_url":"https://api.github.com/repos/thoughtbot/suspenders/branches{/branch}","tags_url":"https://api.github.com/repos/thoughtbot/suspenders/tags","blobs_url":"https://api.github.com/repos/thoughtbot/suspenders/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thoughtbot/suspenders/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thoughtbot/suspenders/git/refs{/sha}","trees_url":"https://api.github.com/repos/thoughtbot/suspenders/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thoughtbot/suspenders/statuses/{sha}","languages_url":"https://api.github.com/repos/thoughtbot/suspenders/languages","stargazers_url":"https://api.github.com/repos/thoughtbot/suspenders/stargazers","contributors_url":"https://api.github.com/repos/thoughtbot/suspenders/contributors","subscribers_url":"https://api.github.com/repos/thoughtbot/suspenders/subscribers","subscription_url":"https://api.github.com/repos/thoughtbot/suspenders/subscription","commits_url":"https://api.github.com/repos/thoughtbot/suspenders/commits{/sha}","git_commits_url":"https://api.github.com/repos/thoughtbot/suspenders/git/commits{/sha}","comments_url":"https://api.github.com/repos/thoughtbot/suspenders/comments{/number}","issue_comment_url":"https://api.github.com/repos/thoughtbot/suspenders/issues/comments{/number}","contents_url":"https://api.github.com/repos/thoughtbot/suspenders/contents/{+path}","compare_url":"https://api.github.com/repos/thoughtbot/suspenders/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thoughtbot/suspenders/merges","archive_url":"https://api.github.com/repos/thoughtbot/suspenders/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thoughtbot/suspenders/downloads","issues_url":"https://api.github.com/repos/thoughtbot/suspenders/issues{/number}","pulls_url":"https://api.github.com/repos/thoughtbot/suspenders/pulls{/number}","milestones_url":"https://api.github.com/repos/thoughtbot/suspenders/milestones{/number}","notifications_url":"https://api.github.com/repos/thoughtbot/suspenders/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thoughtbot/suspenders/labels{/name}","releases_url":"https://api.github.com/repos/thoughtbot/suspenders/releases{/id}","created_at":"2010-05-14T14:34:46Z","updated_at":"2015-12-04T16:05:23Z","pushed_at":"2015-12-04T16:57:47Z","git_url":"git://github.com/thoughtbot/suspenders.git","ssh_url":"git@github.com:thoughtbot/suspenders.git","clone_url":"https://github.com/thoughtbot/suspenders.git","svn_url":"https://github.com/thoughtbot/suspenders","homepage":"https://thoughtbot.com/open-source","size":1420,"stargazers_count":2170,"watchers_count":2170,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":368,"mirror_url":null,"open_issues_count":9,"forks":368,"open_issues":9,"watchers":2170,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thoughtbot/suspenders/pulls/639"},"html":{"href":"https://github.com/thoughtbot/suspenders/pull/639"},"issue":{"href":"https://api.github.com/repos/thoughtbot/suspenders/issues/639"},"comments":{"href":"https://api.github.com/repos/thoughtbot/suspenders/issues/639/comments"},"review_comments":{"href":"https://api.github.com/repos/thoughtbot/suspenders/pulls/639/comments"},"review_comment":{"href":"https://api.github.com/repos/thoughtbot/suspenders/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/thoughtbot/suspenders/pulls/639/commits"},"statuses":{"href":"https://api.github.com/repos/thoughtbot/suspenders/statuses/b35c1f861e5ec66fcc86f69ffd97b88bc68fd43a"}}}}