Trello and Bitbucket Integration – How to Create a Card Comment on a New Changeset

bitbucketintegrationtrello

I'd like to setup a simple workflow: a programmer mentions a card id in the commit message, and some information about the commit is automatically added as a comment to that Trello card. A hosted automatic solution is preferred.

What I've found so far:

Best Answer

After some experimenting with Zapier, I've managed to create a "zap" (i.e. automatic handler) that does the following:

  1. Suppose you're working on a feature which has the following Trello card: https://trello.com/c/NuSGfssX/

  2. You push a commit to Bitbucket, which commit message contains tr(NuSGfssX), e.g.:

    hg ci -m "Finished the very important feature tr(NuSGfssX)"
    
  3. A new Trello card comment is automatically created, containing information about the commit.

Here is how it's done with Zapier:

  1. Create a new zap with services BitBucket (New Changeset) and Trello (Create Comment).

  2. Link your Bitbucket and Trello accounts to Zapier. I used my existing Bitbucket account, though Zapier recommends creating a separate account (which will decrease your free Bitbucket plan:). I also had problems with linking my Trello account, please ask in comments if you had them too.

  3. Select your Bitbucket repository owner and name.

  4. Select your Trello board and List. Both are optional: you may know only the card ID and do not care about where it is. The Card ID is permanent.

  5. In the "Card" field, select "Advanced: type in a custom value". Type {{message_tr}}. The tr is the your (any) chosen identifier, the same as you will use in commit messages.

  6. Setup the Comment Text. My setup is the following (contains a backlink to the bitbucket comment):

    {{message}}
    author: {{author}}
    branch: {{branch}}
    [{{node}}](https://bitbucket.org/<repo_owner>/<repo_name>/commits/{{node}}/)
    
    Files:
    
    {{files}}
    
  7. Click "Turn the Zap on". The Zap is created and starts working.