GitLab API | gitlab gem で Issue のコメント一覧を取得する
概要
gitlab gem で Issue のコメント一覧を取得します。
シグネチャ
issue_notes(project, issue)
project => プロジェクトID
issue => IssueID
サンプル
プロジェクト10件の、各Issue10件に対するコメントを取得します、
require 'gitlab'
Gitlab.configure do |config|
config.endpoint = 'http://some_path/api/v3'
config.private_token = 'your token'
end
Gitlab.projects(per_page: 10).each do |project|
Gitlab.issues(project.id, per_page: 10).each do |issue|
issue_notes = Gitlab.issue_notes(project.id, issue.id)
if issue_notes.size == 0
puts "no issue notes"
else
puts issue_notes.first.body
end
end
end
出力例
some comment1
some comment2
some comment3
参照
GitLab gem RubyGems
https://rubygems.org/gems/gitlabGitLab gem GitHub
https://github.com/NARKOZ/gitlab