タグ API

プロジェクトリポジトリのタグ一覧

プロジェクトのリポジトリタグの一覧を、名前順のアルファベット逆順で取得します。 このエンドポイントは、リポジトリが公開されている場合は認証なしでアクセスできます。

GET /projects/:id/repository/tags

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス
order_by いいえ タグをname またはupdated フィールド updated順に並べたものを返updated します。 デフォルトは updated
sort いいえ タグをasc またはdesc 順序で descソートして返しますdesc 。 デフォルトは desc
search いいえ 検索条件に一致するタグのリストを返します。^termterm$ を使用すると、それぞれterm で始まるタグと で終わるタグを検索できます。

search のサポートは GitLab 11.8 で導入されました。

[
  {
    "commit": {
      "id": "2695effb5807a22ff3d138d593fd856244e155e7",
      "short_id": "2695effb",
      "title": "Initial commit",
      "created_at": "2017-07-26T11:08:53.000+02:00",
      "parent_ids": [
        "2a4b78934375d7f53875269ffd4f45fd83a84ebe"
      ],
      "message": "Initial commit",
      "author_name": "John Smith",
      "author_email": "john@example.com",
      "authored_date": "2012-05-28T04:42:42-07:00",
      "committer_name": "Jack Smith",
      "committer_email": "jack@example.com",
      "committed_date": "2012-05-28T04:42:42-07:00"
    },
    "release": {
      "tag_name": "1.0.0",
      "description": "Amazing release. Wow"
    },
    "name": "v1.0.0",
    "target": "2695effb5807a22ff3d138d593fd856244e155e7",
    "message": null,
    "protected": true
  }
]

単一のリポジトリタグを取得します。

リポジトリが公開されている場合、このエンドポイントは認証なしでアクセスできます。

GET /projects/:id/repository/tags/:tag_name

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス
tag_name はい タグの名前
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/tags/v1.0.0"

回答例

{
  "name": "v5.0.0",
  "message": null,
  "target": "60a8ff033665e1207714d6670fcd7b65304ec02f",
  "commit": {
    "id": "60a8ff033665e1207714d6670fcd7b65304ec02f",
    "short_id": "60a8ff03",
    "title": "Initial commit",
    "created_at": "2017-07-26T11:08:53.000+02:00",
    "parent_ids": [
      "f61c062ff8bcbdb00e0a1b3317a91aed6ceee06b"
    ],
    "message": "v5.0.0\n",
    "author_name": "Arthur Verschaeve",
    "author_email": "contact@arthurverschaeve.be",
    "authored_date": "2015-02-01T21:56:31.000+01:00",
    "committer_name": "Arthur Verschaeve",
    "committer_email": "contact@arthurverschaeve.be",
    "committed_date": "2015-02-01T21:56:31.000+01:00"
  },
  "release": null,
  "protected": false
}

新しいタグの作成

リポジトリに、指定されたrefを指す新しいタグを作成します。

POST /projects/:id/repository/tags

パラメーター

  • id (必須) - 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス
  • tag_name (必須) - タグの名前
  • ref (必須) - コミット SHA、別のタグ名、ブランチ名を使用してタグを作成します。
  • message (オプション) - 注釈付きタグを作成します。
  • release_description (オプション) - Gitタグにリリースノートを追加し、GitLabデータベースに保存します。
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/tags?tag_name=test&ref=master"

回答例

{
  "commit": {
    "id": "2695effb5807a22ff3d138d593fd856244e155e7",
    "short_id": "2695effb",
    "title": "Initial commit",
    "created_at": "2017-07-26T11:08:53.000+02:00",
    "parent_ids": [
      "2a4b78934375d7f53875269ffd4f45fd83a84ebe"
    ],
    "message": "Initial commit",
    "author_name": "John Smith",
    "author_email": "john@example.com",
    "authored_date": "2012-05-28T04:42:42-07:00",
    "committer_name": "Jack Smith",
    "committer_email": "jack@example.com",
    "committed_date": "2012-05-28T04:42:42-07:00"
  },
  "release": {
    "tag_name": "1.0.0",
    "description": "Amazing release. Wow"
  },
  "name": "v1.0.0",
  "target": "2695effb5807a22ff3d138d593fd856244e155e7",
  "message": null,
  "protected": false
}

軽量タグを作成する場合、メッセージはnull 、そうでない場合は注釈が含まれます。

注釈付きタグを作成する場合はタグオブジェクトのIDが、軽量タグを作成する場合はコミットIDがターゲットに含まれます。

エラーの場合、ステータスコード405 とエラーメッセージが返されます。

タグの削除

指定した名前のリポジトリのタグを削除します。

DELETE /projects/:id/repository/tags/:tag_name

パラメーター

新しいリリースの作成

既存の git タグにリリースノートを追加します。 指定したタグのリリースが既に存在する場合は、ステータスコード409 が返されます。

POST /projects/:id/repository/tags/:tag_name/release

パラメーター

リクエスト本文:

  • description (必須) - Markdownをサポートしたリリースノート
{
  "description": "Amazing release. Wow"
}

応答してください:

{
  "tag_name": "1.0.0",
  "description": "Amazing release. Wow"
}

リリースの更新

指定したリリースのリリースノートを更新します。

PUT /projects/:id/repository/tags/:tag_name/release

パラメーター

リクエスト本文:

  • description (必須) - Markdownをサポートしたリリースノート
{
  "description": "Amazing release. Wow"
}

応答してください:

{
  "tag_name": "1.0.0",
  "description": "Amazing release. Wow"
}