Alexander Mills
Alexander Mills

Reputation: 100010

Hook event for git tag created / tag pushed

I am looking at the bitbucket API v2: https://developer.atlassian.com/bitbucket/api/2/reference/resource/hook_events

it says the hook events are:

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

that's right, I sorted the list for them. Anyway, my question is - how can I know if a git tag was created? I am looking to discover when a tag is created/pushed to the bitbucket remote. Anyone know?

Upvotes: 1

Views: 4629

Answers (1)

TheFRedFox
TheFRedFox

Reputation: 710

What you are looking for is the repo:push event. Tags are also pushed to the repository, therefore they also trigger a repo:push event.

Here you can find some more information about the information and payload which will be sent with the webhook: https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-Push

The payload might look something like that:

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

Upvotes: 2

Related Questions