{"meta":{"title":"주석 작업","intro":"REST API를 사용하여 끌어오기 요청, 이슈 또는 커밋의 주석에 액세스하고 관리할 수 있습니다.","product":"REST API","breadcrumbs":[{"href":"/ko/rest","title":"REST API"},{"href":"/ko/rest/guides","title":"가이드"},{"href":"/ko/rest/guides/working-with-comments","title":"주석 작업"}],"documentType":"article"},"body":"# 주석 작업\n\nREST API를 사용하여 끌어오기 요청, 이슈 또는 커밋의 주석에 액세스하고 관리할 수 있습니다.\n\n끌어오기 요청의 경우 GitHub[](https://github.com/octocat/Spoon-Knife/pull/1176#issuecomment-24114792) 끌어오기 요청 내의 [특정 줄에 대한 주석](https://github.com/octocat/Spoon-Knife/pull/1176#discussion_r6252889), 끌어오기 요청 내의 [특정 커밋에 대한 주석](https://github.com/octocat/Spoon-Knife/commit/cbc28e7c8caee26febc8c013b0adfb97a4edd96e#commitcomment-4049848) 등 세 가지 종류의 주석 보기를 제공합니다.\n\n이러한 각 유형의 주석은 API의 GitHub 다른 부분을 통과합니다.\n이 가이드에서는 각 항목에 액세스하고 조작하는 방법을 살펴보겠습니다. 모든 예제에서는 “octocat” 리포지토리에서 [만든 이 샘플 끌어오기 요청](https://github.com/octocat/Spoon-Knife/pull/1176)을 사용합니다. 언제나처럼 샘플은 [플랫폼 샘플 리포지토리](https://github.com/github/platform-samples/tree/master/api/ruby/working-with-comments)에서 찾을 수 있습니다.\n\n## 끌어오기 요청 주석\n\n끌어오기 요청의 댓글에 액세스하려면 [문제를 관리하기 위한 엔드포인트를 사용](/ko/rest/issues/comments)합니다.\n처음에는 직관적이지 않은 것처럼 보일 수 있습니다. 그러나 끌어오기 요청이 코드의 이슈일 뿐이라는 것을 이해하면 이러한 엔드포인트를 사용하여 끌어오기 요청에 대한 주석을 만드는 것이 합리적입니다.\n\n[Octokit.rb](https://github.com/octokit/octokit.rb)를 사용하여 Ruby 스크립트를 만들어서 풀 리퀘스트 주석을 페치하는 방법을 보여줍니다. 또한 [personal access token](/ko/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)를 만드는 것이 좋습니다.\n\n다음 코드는 Octokit.rb를 사용하여 끌어오기 요청에서 주석에 액세스하는 데 도움이 됩니다.\n\n```ruby\nrequire 'octokit'\n\n# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!\n# Instead, set and test environment variables, like below\nclient = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN']\n\nclient.issue_comments(\"octocat/Spoon-Knife\", 1176).each do |comment|\n  username = comment[:user][:login]\n  post_date = comment[:created_at]\n  content = comment[:body]\n\n  puts \"#{username} made a comment on #{post_date}. It says:\\n'#{content}'\\n\"\nend\n```\n\n여기서는 특히 API를 호출하여 주석(`issue_comments`)을 가져오고, 리포지토리의 이름(`octocat/Spoon-Knife`) 및 관심 있는 끌어오기 요청 ID(`1176`)를 모두 제공합니다. 그 후에는 각 주석에 대한 정보를 페치하기 위해 주석을 반복하기만 하면 됩니다.\n\n## 줄의 끌어오기 요청 주석\n\n비교 보기 내에서 끌어오기 요청 내에서 이루어진 단일 변경의 특정 측면에 대한 토론을 시작할 수 있습니다. 이러한 주석은 변경된 파일 내의 개별 줄에서 발생합니다. 이 토론의 엔드포인트 URL은 [끌어오기 요청 검토를 관리하는 엔드포인트](/ko/rest/pulls/comments)에서 가져옵니다.\n\n다음 코드는 단일 끌어오기 요청 번호가 지정된 파일에 대한 모든 끌어오기 요청 주석을 페치합니다.\n\n```ruby\nrequire 'octokit'\n\n# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!\n# Instead, set and test environment variables, like below\nclient = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN']\n\nclient.pull_request_comments(\"octocat/Spoon-Knife\", 1176).each do |comment|\n  username = comment[:user][:login]\n  post_date = comment[:created_at]\n  content = comment[:body]\n  path = comment[:path]\n  position = comment[:position]\n\n  puts \"#{username} made a comment on #{post_date} for the file called #{path}, on line #{position}. It says:\\n'#{content}'\\n\"\nend\n```\n\n위의 예제와 매우 비슷하다는 것을 알 수 있습니다. 이 뷰와 풀 리퀘스트 댓글의 차이점은 대화의 초점입니다.\n끌어오기 요청에 대한 주석은 코드의 전반적인 방향에 대한 토론 또는 아이디어를 위해 예약되어야 합니다. 끌어오기 요청 검토의 일부로 만든 주석은 파일 내에서 특정 변경이 구현된 방식을 구체적으로 다루어야 합니다.\n\n## 커밋 주석\n\n마지막 유형의 주석은 개별 커밋에서 특히 발생합니다. 이러한 이유로 [엔드포인트를 사용하여 커밋 설명을 관리](/ko/rest/commits#get-a-commit-comment)합니다.\n\n커밋에 대한 주석을 검색하려면 커밋의 SHA1을 사용합니다.\n즉, 끌어오기 요청과 관련된 식별자는 사용하지 않습니다. 예를 들면 다음과 같습니다.\n\n```ruby\nrequire 'octokit'\n\n# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!\n# Instead, set and test environment variables, like below\nclient = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN']\n\nclient.commit_comments(\"octocat/Spoon-Knife\", \"cbc28e7c8caee26febc8c013b0adfb97a4edd96e\").each do |comment|\n  username = comment[:user][:login]\n  post_date = comment[:created_at]\n  content = comment[:body]\n\n  puts \"#{username} made a comment on #{post_date}. It says:\\n'#{content}'\\n\"\nend\n```\n\n이 API 호출은 단일 줄 주석과 전체 커밋에 대한 주석을 검색합니다."}