git标签的挂钩事件已创建/标签已推送

时间:2019-07-02 20:34:05

标签: git bitbucket bitbucket-api bitbucket-cloud

我正在查看bitbucket API v2: https://developer.atlassian.com/bitbucket/api/2/reference/resource/hook_events

它说钩子事件是:

issue:comment_created
issue:created
issue:updated
project:updated
pullrequest:approved
pullrequest:comment_created
pullrequest:comment_deleted
pullrequest:comment_updated
pullrequest:created
pullrequest:fulfilled
pullrequest:rejected
pullrequest:unapproved
pullrequest:updated
repo:commit_comment_created
repo:commit_status_created
repo:commit_status_updated
repo:created
repo:deleted
repo:fork
repo:imported
repo:push
repo:transfer
repo:updated

是的,我为他们排序了列表。无论如何,我的问题是-我怎么知道是否创建了 git标签?我希望发现何时将标签创建/推送到bitbucket远程。有人知道吗?

1 个答案:

答案 0 :(得分:1)

您要寻找的是repo:push事件。标记也被推送到存储库,因此它们还会触发repo:push事件。

在这里您可以找到有关将与Webhook一起发送的信息和有效负载的更多信息:https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-Push

有效载荷可能看起来像这样:

{
  "repository": "repo-name",
  "push": {
    "changes": [
      {
        "new": {
          "type": "tag",
          "name": "name-of-tag",
          "target": {
            "type": "commit",
            "hash": "709d658dc5b6d6afcd46049c2f332ee3f515a67d",
            ...
          },
          ...
        }
      },
      ...
    ]
  }
}