Uploaded image for project: 'Bitbucket Server'
  1. Bitbucket Server
  2. BSERV-11847

Include commits/commit message in push (refs_changed) event payload

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Gathering Interest (View Workflow)
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: Webhooks
    • Labels:
      None
    • UIS:
      12
    • Feedback Policy:
      We collect Bitbucket feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      Description

      Currently when users push to a repository, the resulting payload for any configured webhooks does not contain any information surrounding the commits that were pushed. This request is to include this commit information, to a reasonable degree, so that it can be used by the applications receiving the webhook payload. One example of how this could be implemented comes from how these events are handled for the equivalent push payloads in Bitbucket Cloud:

      commits: An array containing up to 5 of the most recent commits pushed to the reference. The array for a push with more than 5 commits is truncated, which is indicated by the truncated property.

      For reference, here is the current payload as it exists in Bitbucket Server today:

      {  
        "eventKey":"repo:refs_changed",
        "date":"2017-09-19T09:45:32+1000",
        "actor":{  
          "name":"admin",
          "emailAddress":"admin@example.com",
          "id":1,
          "displayName":"Administrator",
          "active":true,
          "slug":"admin",
          "type":"NORMAL"
        },
        "repository":{  
          "slug":"repository",
          "id":84,
          "name":"repository",
          "scmId":"git",
          "state":"AVAILABLE",
          "statusMessage":"Available",
          "forkable":true,
          "project":{  
            "key":"PROJ",
            "id":84,
            "name":"project",
            "public":false,
            "type":"NORMAL"
          },
          "public":false
        },
        "changes":[  
          {  
            "ref":{  
              "id":"refs/heads/master",
              "displayId":"master",
              "type":"BRANCH"
            },
            "refId":"refs/heads/master",
            "fromHash":"ecddabb624f6f5ba43816f5926e580a5f680a932",
            "toHash":"178864a7d521b6f5e720b386b2c2b0ef8563e0dc",
            "type":"UPDATE"
          }
        ]
      }
      

      Where this is the payload information from Bitbucket Cloud that would be nice to have implemented in Server:

              "commits": [
                {
                  "hash": "03f4a7270240708834de475bcf21532d6134777e",
                  "type": "commit",
                  "message": "commit message\n",
                  "author": User,
                  "links": {
                    "self": {
                      "href": "https://api.bitbucket.org/2.0/repositories/user/repo/commit/03f4a7270240708834de475bcf21532d6134777e"
                    },
                    "html": {
                      "href": "https://bitbucket.org/user/repo/commits/03f4a7270240708834de475bcf21532d6134777e"
                    }
                  }
                }
              ]
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            eslaughter@atlassian.com Evan Slaughter
            Votes:
            8 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated: