{"action":"created","comment":{"url":"https://api.github.com/repos/progit/progit2-zh/pulls/comments/35750858","id":35750858,"diff_hunk":"@@ -1,48 +1,48 @@\n-=== Scripting GitHub\n+=== 脚本 GitHub\n \n-So now we've covered all of the major features and workflows of GitHub, but any large group or project will have customizations they may want to make or external services they may want to integrate.\n+所以现在我们已经介绍了 GitHub 的大部分功能与工作流程，但是任意一个小组或项目都会去自定义，因为他们想要创造或扩展想要整合的服务。\n \n-Luckily for us, GitHub is really quite hackable in many ways. In this section we'll cover how to use the GitHub hooks system and it's API to make GitHub work how we want it to.\n+对我们来说很幸运的是，GitHub 在许多方面都真的很方便 Hack。在本节中我们将会介绍如何使用 GitHub 钩子系统与 API 接口，使 GitHub 按照我们的设想来工作。\n \n-==== Hooks\n+==== 钩子\n \n-The Hooks and Services section of GitHub repository administration is the easiest way to have GitHub interact with external systems.\n+GitHub 仓库管理中的钩子与服务区块是 GitHub 与外部系统交互最简单的方式。\n \n-===== Services\n+===== 服务\n \n-First we'll take a look at Services. Both the Hooks and Services integrations can be found in the Settings section of your repository, where we previously looked at adding Collaborators and changing the default branch of your project. Under the ``Webhooks and Services'' tab you will see something like <<_services_hooks>>.\n+首先我们来看一下服务。钩子与服务整合都可以在仓库的设置区块中找到，就在我们之前添加协作者与改变项目的默认分支的地方。在 ``Webhooks and Services'' 标签下你会看到与 <<_services_hooks>> 类似的。\n \n [[_services_hooks]]\n-.Services and Hooks configuration section.\n-image::images/scripting-01-services.png[Services and hooks]\n+.服务与钩子配置区域\n+image::images/scripting-01-services.png[服务与钩子]\n \n-There are dozens of services you can choose from, most of them integrations into other commercial and open source systems. Most of them are for Continuous Integration services, bug and issue trackers, chat room systems and documentation systems. We'll walk through setting up a very simple one, the Email hook. If you choose ``email'' from the ``Add Service'' dropdown, you'll get a configuration screen like <<_service_config>>.\n+有许多可以选择的服务，大多数是整合到其他的商业与开源系统中。它们中的大多数是为了整合持续集成服务、BUG 与问题追踪系统、聊天室系统与文档系统。我们将会通过设置一个非常简单的例子来介绍。如果从 ``Add Service'' 选择 ``email''，会得到一个类似 <<_service_config>> 的配置屏幕。\n \n [[_service_config]]\n-.Email service configuration.\n-image::images/scripting-02-email-service.png[Email service]\n+.电子邮件服务配置\n+image::images/scripting-02-email-service.png[电子邮件服务]\n \n-In this case, if we hit the ``Add service'' button, the email address we specified will get an email every time someone pushes to the repository. Services can listen for lots of different types of events, but most only listen for push events and then do something with that data.\n+在本例中，如果我们点击 ``Add service'' 按钮，每次有人推送内容到仓库时，指定的电子邮件地址都会收到一封邮件。服务可以监听许多不同类型的事件，但是大多数只监听推送事件然后使用那些数据做一些事情。\n \n-If there is a system you are using that you would like to integrate with GitHub, you should check here to see if there is an existing service integration available. For example, if you're using Jenkins to run tests on your codebase, you can enable the Jenkins builtin service integration to kick off a test run every time someone pushes to your repository.\n+如果有一个正在使用的系统想要整合到 GitHub，应当先检查这里看有没有已有的可用的服务整合。例如，如果正使用 Jenkins 来测试你的代码库，当每次有人推送到你的仓库时你可以启用 Jenkins 内置的整合启动测试运行。\n \n-===== Hooks\n+===== 钩子\n \n-If you need something more specific or you want to integrate with a service or site that is not included in this list, you can instead use the more generic hooks system. GitHub repository hooks are pretty simple. You specify a URL and GitHub will post an HTTP payload to that URL on any event you want.\n+如果需要做一些更具体的事，或者想要整合一个不在这个列表中的服务或站点，可以转而使用更通用的钩子系统。GitHub 仓库钩子是非常简单的。指定一个 URL 然后 GitHub 在任一期望的事件发生时就会发送一个 HTTP 请求到那个 URL 。\n \n-Generally the way this works is you can setup a small web service to listen for a GitHub hook payload and then do something with the data when it is received.\n+通常做这件事的方式是可以设置一个小的 web 服务来监听 GitHub 钩子请求然后使用收到的数据做一些事情。\n \n-To enable a hook, you click the ``Add webhook'' button in <<_services_hooks>>. This will bring you to a page that looks like <<_web_hook>>.\n+为了启用一个钩子，点击 <<_services_hooks>> 中的 ``Add webhook'' 按钮。这会将你引导至一个类似 <<_web_hook>> 的页面。\n \n [[_web_hook]]\n-.Web hook configuration.\n-image::images/scripting-03-webhook.png[Web hook]\n+.Web 钩子配置\n+image::images/scripting-03-webhook.png[Web 钩子配置]\n \n-The configuration for a web hook is pretty simple. In most cases you simply enter a URL and a secret key and hit ``Add webhook''. There are a few options for which events you want GitHub to send you a payload for -- the default is to only get a payload for the `push` event, when someone pushes new code to any branch of your repository.\n+Web 钩子的设置非常简单。大多数情况下只需要输入一个 URL 与一个密钥后点击 ``Add webhook''。有几个选项可以指定在哪个事件时想要 GitHub 发送请求 -- 默认的行为是只有在 `push` 事件时获得一个请求，当某人推送新代码到仓库的任一分支时。","path":"book/06-github/sections/5-scripting.asc","position":62,"original_position":62,"commit_id":"30c8f7f4b1deb7929089d31f583857dcd00f876a","original_commit_id":"30c8f7f4b1deb7929089d31f583857dcd00f876a","user":{"login":"IceNature","id":7970130,"avatar_url":"https://avatars.githubusercontent.com/u/7970130?v=3","gravatar_id":"","url":"https://api.github.com/users/IceNature","html_url":"https://github.com/IceNature","followers_url":"https://api.github.com/users/IceNature/followers","following_url":"https://api.github.com/users/IceNature/following{/other_user}","gists_url":"https://api.github.com/users/IceNature/gists{/gist_id}","starred_url":"https://api.github.com/users/IceNature/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IceNature/subscriptions","organizations_url":"https://api.github.com/users/IceNature/orgs","repos_url":"https://api.github.com/users/IceNature/repos","events_url":"https://api.github.com/users/IceNature/events{/privacy}","received_events_url":"https://api.github.com/users/IceNature/received_events","type":"User","site_admin":false},"body":"与一个密钥后点击=》与一个密钥然后点击","created_at":"2015-07-29T11:55:33Z","updated_at":"2015-07-29T11:55:33Z","html_url":"https://github.com/progit/progit2-zh/pull/163#discussion_r35750858","pull_request_url":"https://api.github.com/repos/progit/progit2-zh/pulls/163","_links":{"self":{"href":"https://api.github.com/repos/progit/progit2-zh/pulls/comments/35750858"},"html":{"href":"https://github.com/progit/progit2-zh/pull/163#discussion_r35750858"},"pull_request":{"href":"https://api.github.com/repos/progit/progit2-zh/pulls/163"}}},"pull_request":{"url":"https://api.github.com/repos/progit/progit2-zh/pulls/163","id":39147940,"html_url":"https://github.com/progit/progit2-zh/pull/163","diff_url":"https://github.com/progit/progit2-zh/pull/163.diff","patch_url":"https://github.com/progit/progit2-zh/pull/163.patch","issue_url":"https://api.github.com/repos/progit/progit2-zh/issues/163","number":163,"state":"open","locked":false,"title":"Translate 06-github 5-scripting v2","user":{"login":"networm","id":440624,"avatar_url":"https://avatars.githubusercontent.com/u/440624?v=3","gravatar_id":"","url":"https://api.github.com/users/networm","html_url":"https://github.com/networm","followers_url":"https://api.github.com/users/networm/followers","following_url":"https://api.github.com/users/networm/following{/other_user}","gists_url":"https://api.github.com/users/networm/gists{/gist_id}","starred_url":"https://api.github.com/users/networm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/networm/subscriptions","organizations_url":"https://api.github.com/users/networm/orgs","repos_url":"https://api.github.com/users/networm/repos","events_url":"https://api.github.com/users/networm/events{/privacy}","received_events_url":"https://api.github.com/users/networm/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-03T06:00:20Z","updated_at":"2015-07-29T11:55:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cb72487aa419951cc3f83e59848f2289d26acf4c","assignee":null,"milestone":{"url":"https://api.github.com/repos/progit/progit2-zh/milestones/1","html_url":"https://github.com/progit/progit2-zh/milestones/v1.0.0","labels_url":"https://api.github.com/repos/progit/progit2-zh/milestones/1/labels","id":1231002,"number":1,"title":"v1.0.0","description":"所有内容翻译完成并经过审校后合并入主干分支。","creator":{"login":"networm","id":440624,"avatar_url":"https://avatars.githubusercontent.com/u/440624?v=3","gravatar_id":"","url":"https://api.github.com/users/networm","html_url":"https://github.com/networm","followers_url":"https://api.github.com/users/networm/followers","following_url":"https://api.github.com/users/networm/following{/other_user}","gists_url":"https://api.github.com/users/networm/gists{/gist_id}","starred_url":"https://api.github.com/users/networm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/networm/subscriptions","organizations_url":"https://api.github.com/users/networm/orgs","repos_url":"https://api.github.com/users/networm/repos","events_url":"https://api.github.com/users/networm/events{/privacy}","received_events_url":"https://api.github.com/users/networm/received_events","type":"User","site_admin":false},"open_issues":53,"closed_issues":2,"state":"open","created_at":"2015-07-29T06:50:16Z","updated_at":"2015-07-29T08:09:55Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/progit/progit2-zh/pulls/163/commits","review_comments_url":"https://api.github.com/repos/progit/progit2-zh/pulls/163/comments","review_comment_url":"https://api.github.com/repos/progit/progit2-zh/pulls/comments{/number}","comments_url":"https://api.github.com/repos/progit/progit2-zh/issues/163/comments","statuses_url":"https://api.github.com/repos/progit/progit2-zh/statuses/30c8f7f4b1deb7929089d31f583857dcd00f876a","head":{"label":"networm:06-github_5-scripting","ref":"06-github_5-scripting","sha":"30c8f7f4b1deb7929089d31f583857dcd00f876a","user":{"login":"networm","id":440624,"avatar_url":"https://avatars.githubusercontent.com/u/440624?v=3","gravatar_id":"","url":"https://api.github.com/users/networm","html_url":"https://github.com/networm","followers_url":"https://api.github.com/users/networm/followers","following_url":"https://api.github.com/users/networm/following{/other_user}","gists_url":"https://api.github.com/users/networm/gists{/gist_id}","starred_url":"https://api.github.com/users/networm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/networm/subscriptions","organizations_url":"https://api.github.com/users/networm/orgs","repos_url":"https://api.github.com/users/networm/repos","events_url":"https://api.github.com/users/networm/events{/privacy}","received_events_url":"https://api.github.com/users/networm/received_events","type":"User","site_admin":false},"repo":{"id":28445173,"name":"progit2-zh","full_name":"networm/progit2-zh","owner":{"login":"networm","id":440624,"avatar_url":"https://avatars.githubusercontent.com/u/440624?v=3","gravatar_id":"","url":"https://api.github.com/users/networm","html_url":"https://github.com/networm","followers_url":"https://api.github.com/users/networm/followers","following_url":"https://api.github.com/users/networm/following{/other_user}","gists_url":"https://api.github.com/users/networm/gists{/gist_id}","starred_url":"https://api.github.com/users/networm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/networm/subscriptions","organizations_url":"https://api.github.com/users/networm/orgs","repos_url":"https://api.github.com/users/networm/repos","events_url":"https://api.github.com/users/networm/events{/privacy}","received_events_url":"https://api.github.com/users/networm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/networm/progit2-zh","description":"","fork":true,"url":"https://api.github.com/repos/networm/progit2-zh","forks_url":"https://api.github.com/repos/networm/progit2-zh/forks","keys_url":"https://api.github.com/repos/networm/progit2-zh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/networm/progit2-zh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/networm/progit2-zh/teams","hooks_url":"https://api.github.com/repos/networm/progit2-zh/hooks","issue_events_url":"https://api.github.com/repos/networm/progit2-zh/issues/events{/number}","events_url":"https://api.github.com/repos/networm/progit2-zh/events","assignees_url":"https://api.github.com/repos/networm/progit2-zh/assignees{/user}","branches_url":"https://api.github.com/repos/networm/progit2-zh/branches{/branch}","tags_url":"https://api.github.com/repos/networm/progit2-zh/tags","blobs_url":"https://api.github.com/repos/networm/progit2-zh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/networm/progit2-zh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/networm/progit2-zh/git/refs{/sha}","trees_url":"https://api.github.com/repos/networm/progit2-zh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/networm/progit2-zh/statuses/{sha}","languages_url":"https://api.github.com/repos/networm/progit2-zh/languages","stargazers_url":"https://api.github.com/repos/networm/progit2-zh/stargazers","contributors_url":"https://api.github.com/repos/networm/progit2-zh/contributors","subscribers_url":"https://api.github.com/repos/networm/progit2-zh/subscribers","subscription_url":"https://api.github.com/repos/networm/progit2-zh/subscription","commits_url":"https://api.github.com/repos/networm/progit2-zh/commits{/sha}","git_commits_url":"https://api.github.com/repos/networm/progit2-zh/git/commits{/sha}","comments_url":"https://api.github.com/repos/networm/progit2-zh/comments{/number}","issue_comment_url":"https://api.github.com/repos/networm/progit2-zh/issues/comments{/number}","contents_url":"https://api.github.com/repos/networm/progit2-zh/contents/{+path}","compare_url":"https://api.github.com/repos/networm/progit2-zh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/networm/progit2-zh/merges","archive_url":"https://api.github.com/repos/networm/progit2-zh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/networm/progit2-zh/downloads","issues_url":"https://api.github.com/repos/networm/progit2-zh/issues{/number}","pulls_url":"https://api.github.com/repos/networm/progit2-zh/pulls{/number}","milestones_url":"https://api.github.com/repos/networm/progit2-zh/milestones{/number}","notifications_url":"https://api.github.com/repos/networm/progit2-zh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/networm/progit2-zh/labels{/name}","releases_url":"https://api.github.com/repos/networm/progit2-zh/releases{/id}","created_at":"2014-12-24T10:12:38Z","updated_at":"2015-07-29T02:43:37Z","pushed_at":"2015-07-29T11:16:10Z","git_url":"git://github.com/networm/progit2-zh.git","ssh_url":"git@github.com:networm/progit2-zh.git","clone_url":"https://github.com/networm/progit2-zh.git","svn_url":"https://github.com/networm/progit2-zh","homepage":null,"size":160082,"stargazers_count":2,"watchers_count":2,"language":"CSS","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"progit:master","ref":"master","sha":"5d1559eefe4a24a1c1161fbcd1dda13f98941d16","user":{"login":"progit","id":95588,"avatar_url":"https://avatars.githubusercontent.com/u/95588?v=3","gravatar_id":"","url":"https://api.github.com/users/progit","html_url":"https://github.com/progit","followers_url":"https://api.github.com/users/progit/followers","following_url":"https://api.github.com/users/progit/following{/other_user}","gists_url":"https://api.github.com/users/progit/gists{/gist_id}","starred_url":"https://api.github.com/users/progit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/progit/subscriptions","organizations_url":"https://api.github.com/users/progit/orgs","repos_url":"https://api.github.com/users/progit/repos","events_url":"https://api.github.com/users/progit/events{/privacy}","received_events_url":"https://api.github.com/users/progit/received_events","type":"Organization","site_admin":false},"repo":{"id":26017730,"name":"progit2-zh","full_name":"progit/progit2-zh","owner":{"login":"progit","id":95588,"avatar_url":"https://avatars.githubusercontent.com/u/95588?v=3","gravatar_id":"","url":"https://api.github.com/users/progit","html_url":"https://github.com/progit","followers_url":"https://api.github.com/users/progit/followers","following_url":"https://api.github.com/users/progit/following{/other_user}","gists_url":"https://api.github.com/users/progit/gists{/gist_id}","starred_url":"https://api.github.com/users/progit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/progit/subscriptions","organizations_url":"https://api.github.com/users/progit/orgs","repos_url":"https://api.github.com/users/progit/repos","events_url":"https://api.github.com/users/progit/events{/privacy}","received_events_url":"https://api.github.com/users/progit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/progit/progit2-zh","description":"","fork":false,"url":"https://api.github.com/repos/progit/progit2-zh","forks_url":"https://api.github.com/repos/progit/progit2-zh/forks","keys_url":"https://api.github.com/repos/progit/progit2-zh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/progit/progit2-zh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/progit/progit2-zh/teams","hooks_url":"https://api.github.com/repos/progit/progit2-zh/hooks","issue_events_url":"https://api.github.com/repos/progit/progit2-zh/issues/events{/number}","events_url":"https://api.github.com/repos/progit/progit2-zh/events","assignees_url":"https://api.github.com/repos/progit/progit2-zh/assignees{/user}","branches_url":"https://api.github.com/repos/progit/progit2-zh/branches{/branch}","tags_url":"https://api.github.com/repos/progit/progit2-zh/tags","blobs_url":"https://api.github.com/repos/progit/progit2-zh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/progit/progit2-zh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/progit/progit2-zh/git/refs{/sha}","trees_url":"https://api.github.com/repos/progit/progit2-zh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/progit/progit2-zh/statuses/{sha}","languages_url":"https://api.github.com/repos/progit/progit2-zh/languages","stargazers_url":"https://api.github.com/repos/progit/progit2-zh/stargazers","contributors_url":"https://api.github.com/repos/progit/progit2-zh/contributors","subscribers_url":"https://api.github.com/repos/progit/progit2-zh/subscribers","subscription_url":"https://api.github.com/repos/progit/progit2-zh/subscription","commits_url":"https://api.github.com/repos/progit/progit2-zh/commits{/sha}","git_commits_url":"https://api.github.com/repos/progit/progit2-zh/git/commits{/sha}","comments_url":"https://api.github.com/repos/progit/progit2-zh/comments{/number}","issue_comment_url":"https://api.github.com/repos/progit/progit2-zh/issues/comments{/number}","contents_url":"https://api.github.com/repos/progit/progit2-zh/contents/{+path}","compare_url":"https://api.github.com/repos/progit/progit2-zh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/progit/progit2-zh/merges","archive_url":"https://api.github.com/repos/progit/progit2-zh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/progit/progit2-zh/downloads","issues_url":"https://api.github.com/repos/progit/progit2-zh/issues{/number}","pulls_url":"https://api.github.com/repos/progit/progit2-zh/pulls{/number}","milestones_url":"https://api.github.com/repos/progit/progit2-zh/milestones{/number}","notifications_url":"https://api.github.com/repos/progit/progit2-zh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/progit/progit2-zh/labels{/name}","releases_url":"https://api.github.com/repos/progit/progit2-zh/releases{/id}","created_at":"2014-10-31T13:43:10Z","updated_at":"2015-07-29T11:24:59Z","pushed_at":"2015-07-29T11:19:33Z","git_url":"git://github.com/progit/progit2-zh.git","ssh_url":"git@github.com:progit/progit2-zh.git","clone_url":"https://github.com/progit/progit2-zh.git","svn_url":"https://github.com/progit/progit2-zh","homepage":null,"size":161069,"stargazers_count":278,"watchers_count":278,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":99,"mirror_url":null,"open_issues_count":70,"forks":99,"open_issues":70,"watchers":278,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/progit/progit2-zh/pulls/163"},"html":{"href":"https://github.com/progit/progit2-zh/pull/163"},"issue":{"href":"https://api.github.com/repos/progit/progit2-zh/issues/163"},"comments":{"href":"https://api.github.com/repos/progit/progit2-zh/issues/163/comments"},"review_comments":{"href":"https://api.github.com/repos/progit/progit2-zh/pulls/163/comments"},"review_comment":{"href":"https://api.github.com/repos/progit/progit2-zh/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/progit/progit2-zh/pulls/163/commits"},"statuses":{"href":"https://api.github.com/repos/progit/progit2-zh/statuses/30c8f7f4b1deb7929089d31f583857dcd00f876a"}}}}