Pull Request API Activity Endpoint Doesn’t Show Original Destination Branch When Updated Later

XMLWordPrintable

    • 2
    • Severity 3 - Minor
    • 241

      Issue Summary

      When a pull request is created from branch A → branch B, and the destination branch is later changed (from branch B → branch C), the API activity endpoint does not log the branch change event.
      The PR creation event then incorrectly shows the updated destination branch (branch C) instead of the original branch B during PR creation, and no activity event captures this change.

      Steps to Reproduce

       

      • Create a PR from branch A → branch B.
      • Change the destination branch from branch B → branch C.
        Perform a GET API request:
      GET https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests/{id}/activity
      
      

      Expected Results

      The activity log should include the original destination branch (branch B) in the creation event and record an update event when the destination branch changes.

      "update": {
          "state": "OPEN",
          ...
          "destination": {
              "branch": {
                  "name": "branch b"
              }
          }
      }
      

      Actual Results

      Actual Results
      The creation event directly reflects the new destination branch (branch C) instead of the original, with no intermediate update event logged.

      "update": {
          "state": "OPEN",
          ...
          "destination": {
              "branch": {
                  "name": "branch c"
              }
          }
      }
      

      Workaround

      As a workaround, track the destination commit hash in the event payload under destination.commit.hash.
      By tracing changes in the commit history, you can infer the original destination branch — especially when unrelated branches are switched, as the commit ancestry can help identify the original branch.

            Assignee:
            Unassigned
            Reporter:
            Suhas Sundararaju
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: