{"action":"created","comment":{"url":"https://api.github.com/repos/zalando/zappr/pulls/comments/71136354","id":71136354,"diff_hunk":"@@ -132,27 +136,52 @@ export default class Specification extends Check {\n       [MINIMUM_LENGTH]: {\n         enabled: shouldCheckLength,\n         fn: isLongEnough.bind(null, body, requiredLength)\n+      },\n+      [DIFFERS_FROM_TEMPLATE]: {\n+        enabled: shouldCheckPrTemplate,\n+        fn: this._differsFromPrTemplate.bind(this, body, user, repo, token)\n       }\n     }\n \n     // array to force the order\n-    const [success, failedChecks] = [CONTAINS_ISSUE_NUMBER, CONTAINS_URL, MINIMUM_LENGTH]\n-      .reduce(([success, failedChecks], checkName) => {\n-        const { enabled, fn: check } = checksMapping[checkName]\n-        if (enabled) {\n-          const res = check()\n-          if (!res) {\n-            failedChecks.push(`'${checkName}'`)\n-          }\n-\n-          success = success || res\n+    const [success, failedChecks] = await [\n+      CONTAINS_ISSUE_NUMBER, CONTAINS_URL, DIFFERS_FROM_TEMPLATE, MINIMUM_LENGTH\n+    ].reduce(async(awaitable, checkName) => {\n+      const {enabled, fn: check} = checksMapping[checkName]\n+      let [success, failedChecks] = await awaitable\n+\n+      if (enabled) {\n+        const res = await check()\n+        if (!res) {\n+          failedChecks.push(`'${checkName}'`)\n         }\n \n-        return [success, failedChecks]\n+        success = success || res\n+      }\n+\n+      return [success, failedChecks]\n     }, [undefined, []])\n \n     if (!success) {\n       throw new Error(`PR's body failed check ${failedChecks[0]}`)\n     }\n   }\n+\n+  /**\n+   * @param {string} content to compare\n+   * @param {string} user\n+   * @param {string} repo\n+   * @param {string} accessToken\n+   *\n+   * @return {boolean} true if `content` is not equal to template. False otherwise\n+   *\n+   * @private\n+   */\n+  _differsFromPrTemplate(content, user, repo, accessToken) {\n+    return this.github.readPullRequestTemplate(user, repo, accessToken)\n+      .then((template) => template !== content, () => {\n+        info(`${user}/${repo}: No PULL_REQUEST_TEMPLATE found`)\n+        return false","path":"server/checks/Specification.js","position":106,"original_position":106,"commit_id":"3397adf98bbda791943bcc84dbd0e773fbeb1e71","original_commit_id":"befe3216142c007dc5ce50797b9c713b9318d542","user":{"login":"prayerslayer","id":878512,"avatar_url":"https://avatars.githubusercontent.com/u/878512?v=3","gravatar_id":"","url":"https://api.github.com/users/prayerslayer","html_url":"https://github.com/prayerslayer","followers_url":"https://api.github.com/users/prayerslayer/followers","following_url":"https://api.github.com/users/prayerslayer/following{/other_user}","gists_url":"https://api.github.com/users/prayerslayer/gists{/gist_id}","starred_url":"https://api.github.com/users/prayerslayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prayerslayer/subscriptions","organizations_url":"https://api.github.com/users/prayerslayer/orgs","repos_url":"https://api.github.com/users/prayerslayer/repos","events_url":"https://api.github.com/users/prayerslayer/events{/privacy}","received_events_url":"https://api.github.com/users/prayerslayer/received_events","type":"User","site_admin":false},"body":"I guess you could argue that, yes :) However we would enable this check by default in our Zappr Enterprise config, without everybody actually using PR templates. Imo it should just mean \"in case you're using a template, the PR body must be different.\"","created_at":"2016-07-18T12:09:53Z","updated_at":"2016-07-18T12:09:53Z","html_url":"https://github.com/zalando/zappr/pull/371#discussion_r71136354","pull_request_url":"https://api.github.com/repos/zalando/zappr/pulls/371","_links":{"self":{"href":"https://api.github.com/repos/zalando/zappr/pulls/comments/71136354"},"html":{"href":"https://github.com/zalando/zappr/pull/371#discussion_r71136354"},"pull_request":{"href":"https://api.github.com/repos/zalando/zappr/pulls/371"}}},"pull_request":{"url":"https://api.github.com/repos/zalando/zappr/pulls/371","id":77771518,"html_url":"https://github.com/zalando/zappr/pull/371","diff_url":"https://github.com/zalando/zappr/pull/371.diff","patch_url":"https://github.com/zalando/zappr/pull/371.patch","issue_url":"https://api.github.com/repos/zalando/zappr/issues/371","number":371,"state":"open","locked":false,"title":"#368 feat: add pr template equality check","user":{"login":"gagoman","id":1894766,"avatar_url":"https://avatars.githubusercontent.com/u/1894766?v=3","gravatar_id":"","url":"https://api.github.com/users/gagoman","html_url":"https://github.com/gagoman","followers_url":"https://api.github.com/users/gagoman/followers","following_url":"https://api.github.com/users/gagoman/following{/other_user}","gists_url":"https://api.github.com/users/gagoman/gists{/gist_id}","starred_url":"https://api.github.com/users/gagoman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gagoman/subscriptions","organizations_url":"https://api.github.com/users/gagoman/orgs","repos_url":"https://api.github.com/users/gagoman/repos","events_url":"https://api.github.com/users/gagoman/events{/privacy}","received_events_url":"https://api.github.com/users/gagoman/received_events","type":"User","site_admin":false},"body":"Closes #368 \r\n\r\nTODO:\r\n\r\n- [x] Feature\r\n- [x] Tests for 'specification' check\r\n- [ ] Tests for 'API' calls","created_at":"2016-07-18T08:07:59Z","updated_at":"2016-07-18T12:09:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ca15a91d437dd30eea65061c07d778c19b55b387","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/zalando/zappr/pulls/371/commits","review_comments_url":"https://api.github.com/repos/zalando/zappr/pulls/371/comments","review_comment_url":"https://api.github.com/repos/zalando/zappr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zalando/zappr/issues/371/comments","statuses_url":"https://api.github.com/repos/zalando/zappr/statuses/3397adf98bbda791943bcc84dbd0e773fbeb1e71","head":{"label":"gagoman:368","ref":"368","sha":"3397adf98bbda791943bcc84dbd0e773fbeb1e71","user":{"login":"gagoman","id":1894766,"avatar_url":"https://avatars.githubusercontent.com/u/1894766?v=3","gravatar_id":"","url":"https://api.github.com/users/gagoman","html_url":"https://github.com/gagoman","followers_url":"https://api.github.com/users/gagoman/followers","following_url":"https://api.github.com/users/gagoman/following{/other_user}","gists_url":"https://api.github.com/users/gagoman/gists{/gist_id}","starred_url":"https://api.github.com/users/gagoman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gagoman/subscriptions","organizations_url":"https://api.github.com/users/gagoman/orgs","repos_url":"https://api.github.com/users/gagoman/repos","events_url":"https://api.github.com/users/gagoman/events{/privacy}","received_events_url":"https://api.github.com/users/gagoman/received_events","type":"User","site_admin":false},"repo":{"id":63064190,"name":"zappr","full_name":"gagoman/zappr","owner":{"login":"gagoman","id":1894766,"avatar_url":"https://avatars.githubusercontent.com/u/1894766?v=3","gravatar_id":"","url":"https://api.github.com/users/gagoman","html_url":"https://github.com/gagoman","followers_url":"https://api.github.com/users/gagoman/followers","following_url":"https://api.github.com/users/gagoman/following{/other_user}","gists_url":"https://api.github.com/users/gagoman/gists{/gist_id}","starred_url":"https://api.github.com/users/gagoman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gagoman/subscriptions","organizations_url":"https://api.github.com/users/gagoman/orgs","repos_url":"https://api.github.com/users/gagoman/repos","events_url":"https://api.github.com/users/gagoman/events{/privacy}","received_events_url":"https://api.github.com/users/gagoman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gagoman/zappr","description":"Enhance your Github workflow with the simple flip of a toggle","fork":true,"url":"https://api.github.com/repos/gagoman/zappr","forks_url":"https://api.github.com/repos/gagoman/zappr/forks","keys_url":"https://api.github.com/repos/gagoman/zappr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gagoman/zappr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gagoman/zappr/teams","hooks_url":"https://api.github.com/repos/gagoman/zappr/hooks","issue_events_url":"https://api.github.com/repos/gagoman/zappr/issues/events{/number}","events_url":"https://api.github.com/repos/gagoman/zappr/events","assignees_url":"https://api.github.com/repos/gagoman/zappr/assignees{/user}","branches_url":"https://api.github.com/repos/gagoman/zappr/branches{/branch}","tags_url":"https://api.github.com/repos/gagoman/zappr/tags","blobs_url":"https://api.github.com/repos/gagoman/zappr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gagoman/zappr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gagoman/zappr/git/refs{/sha}","trees_url":"https://api.github.com/repos/gagoman/zappr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gagoman/zappr/statuses/{sha}","languages_url":"https://api.github.com/repos/gagoman/zappr/languages","stargazers_url":"https://api.github.com/repos/gagoman/zappr/stargazers","contributors_url":"https://api.github.com/repos/gagoman/zappr/contributors","subscribers_url":"https://api.github.com/repos/gagoman/zappr/subscribers","subscription_url":"https://api.github.com/repos/gagoman/zappr/subscription","commits_url":"https://api.github.com/repos/gagoman/zappr/commits{/sha}","git_commits_url":"https://api.github.com/repos/gagoman/zappr/git/commits{/sha}","comments_url":"https://api.github.com/repos/gagoman/zappr/comments{/number}","issue_comment_url":"https://api.github.com/repos/gagoman/zappr/issues/comments{/number}","contents_url":"https://api.github.com/repos/gagoman/zappr/contents/{+path}","compare_url":"https://api.github.com/repos/gagoman/zappr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gagoman/zappr/merges","archive_url":"https://api.github.com/repos/gagoman/zappr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gagoman/zappr/downloads","issues_url":"https://api.github.com/repos/gagoman/zappr/issues{/number}","pulls_url":"https://api.github.com/repos/gagoman/zappr/pulls{/number}","milestones_url":"https://api.github.com/repos/gagoman/zappr/milestones{/number}","notifications_url":"https://api.github.com/repos/gagoman/zappr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gagoman/zappr/labels{/name}","releases_url":"https://api.github.com/repos/gagoman/zappr/releases{/id}","deployments_url":"https://api.github.com/repos/gagoman/zappr/deployments","created_at":"2016-07-11T12:00:11Z","updated_at":"2016-07-11T12:00:12Z","pushed_at":"2016-07-18T12:01:01Z","git_url":"git://github.com/gagoman/zappr.git","ssh_url":"git@github.com:gagoman/zappr.git","clone_url":"https://github.com/gagoman/zappr.git","svn_url":"https://github.com/gagoman/zappr","homepage":"https://zappr.opensource.zalan.do","size":1410,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"zalando:master","ref":"master","sha":"70b74853dee156accfbb4a943a1bdc59caa00a6e","user":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"repo":{"id":47964688,"name":"zappr","full_name":"zalando/zappr","owner":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zalando/zappr","description":"Enhance your Github workflow with the simple flip of a toggle","fork":false,"url":"https://api.github.com/repos/zalando/zappr","forks_url":"https://api.github.com/repos/zalando/zappr/forks","keys_url":"https://api.github.com/repos/zalando/zappr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zalando/zappr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zalando/zappr/teams","hooks_url":"https://api.github.com/repos/zalando/zappr/hooks","issue_events_url":"https://api.github.com/repos/zalando/zappr/issues/events{/number}","events_url":"https://api.github.com/repos/zalando/zappr/events","assignees_url":"https://api.github.com/repos/zalando/zappr/assignees{/user}","branches_url":"https://api.github.com/repos/zalando/zappr/branches{/branch}","tags_url":"https://api.github.com/repos/zalando/zappr/tags","blobs_url":"https://api.github.com/repos/zalando/zappr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zalando/zappr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zalando/zappr/git/refs{/sha}","trees_url":"https://api.github.com/repos/zalando/zappr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zalando/zappr/statuses/{sha}","languages_url":"https://api.github.com/repos/zalando/zappr/languages","stargazers_url":"https://api.github.com/repos/zalando/zappr/stargazers","contributors_url":"https://api.github.com/repos/zalando/zappr/contributors","subscribers_url":"https://api.github.com/repos/zalando/zappr/subscribers","subscription_url":"https://api.github.com/repos/zalando/zappr/subscription","commits_url":"https://api.github.com/repos/zalando/zappr/commits{/sha}","git_commits_url":"https://api.github.com/repos/zalando/zappr/git/commits{/sha}","comments_url":"https://api.github.com/repos/zalando/zappr/comments{/number}","issue_comment_url":"https://api.github.com/repos/zalando/zappr/issues/comments{/number}","contents_url":"https://api.github.com/repos/zalando/zappr/contents/{+path}","compare_url":"https://api.github.com/repos/zalando/zappr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zalando/zappr/merges","archive_url":"https://api.github.com/repos/zalando/zappr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zalando/zappr/downloads","issues_url":"https://api.github.com/repos/zalando/zappr/issues{/number}","pulls_url":"https://api.github.com/repos/zalando/zappr/pulls{/number}","milestones_url":"https://api.github.com/repos/zalando/zappr/milestones{/number}","notifications_url":"https://api.github.com/repos/zalando/zappr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zalando/zappr/labels{/name}","releases_url":"https://api.github.com/repos/zalando/zappr/releases{/id}","deployments_url":"https://api.github.com/repos/zalando/zappr/deployments","created_at":"2015-12-14T09:26:18Z","updated_at":"2016-07-13T08:28:07Z","pushed_at":"2016-07-18T12:01:01Z","git_url":"git://github.com/zalando/zappr.git","ssh_url":"git@github.com:zalando/zappr.git","clone_url":"https://github.com/zalando/zappr.git","svn_url":"https://github.com/zalando/zappr","homepage":"https://zappr.opensource.zalan.do","size":1922,"stargazers_count":104,"watchers_count":104,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":47,"forks":11,"open_issues":47,"watchers":104,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zalando/zappr/pulls/371"},"html":{"href":"https://github.com/zalando/zappr/pull/371"},"issue":{"href":"https://api.github.com/repos/zalando/zappr/issues/371"},"comments":{"href":"https://api.github.com/repos/zalando/zappr/issues/371/comments"},"review_comments":{"href":"https://api.github.com/repos/zalando/zappr/pulls/371/comments"},"review_comment":{"href":"https://api.github.com/repos/zalando/zappr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zalando/zappr/pulls/371/commits"},"statuses":{"href":"https://api.github.com/repos/zalando/zappr/statuses/3397adf98bbda791943bcc84dbd0e773fbeb1e71"}}}}
{"actor":{"display_login":"prayerslayer"}}