LoginSignup
3
3

More than 5 years have passed since last update.

GitLab API | gitlab gem で 新規Issueの作成

Posted at

GitLab API | gitlab gem で 新規Issueの作成

概要

gitlab gem で 新規Issueの作成

シグネチャ

create_issue(project, title, options = {})

project は プロジェクトの id
title は Issue のタイトル文字列

option type 内容
:description String Issueの内容。Markdownで記述
:assignee_id Integer アサイン先のid
:milestone_id Integer マイルストーンのid
:labels String カンマ区切りのラベル名のリスト

サンプル

Issue の title 「api test」
Issue の description 「api test」
Issue の assignee_id 「4」
Issue の labels ruby と gitlab
で新規 Issue を作成します。

require 'gitlab'

Gitlab.configure do |config|
  config.endpoint       = 'http://some_path/api/v3' 
  config.private_token  = 'your token'
end
puts Gitlab.issues.size # => この段階では 0
project_id = 31
issue_title = 'api test'
options = {
  description: 'description',
  assignee_id: 4,
  labels: 'ruby,gitlab',
}
Gitlab.create_issue(project_id, issue_title, options)
puts Gitlab.issues.size # => この段階では 1

出力

0
1

参照

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3