comments 5

Speed Project: Git Hook for Asana

For those who know me, you know I love Asana. Since I started using it, I ditched every project manager and every to-do list app that I’ve ever tried before. I might write more about it later, but today’s post isn’t about that.

A few weeks ago, Asana launched their API and today I decided to play a bit with it.
I put my bash scripting skills to practice, and rocked this little git post-commit hook that adds a comment to a task (in Asana) when you reference a task in a commit.

If you use Asana for software development projects, and you use git, give it a try, and tell me what you think.

Setup

First, you need to add this script to your repository in .git/hooks/post-commit:

After that, you need to add your Asana API key to your local git configurations (you can get your API key here)

git config --global user.asana-key "FcZ23.M4xsMtXmTKmDA4ssLCkEnYi"

Optionally, you can set the Workspace ID or the Project ID that you are working on that git repository

git config --local user.asana-workspace "262108189595"

git config --local user.asana-project "291570277398"

Now you’re ready to go.

Usage

Now, whenever you commit something, you have to ways to reference a commit to a Asana task:

  1. reference the task id in the comment using “#task-id” format
  2. wait for the post commit prompt where you can list all of the tasks assigned to you (in the workspace or project you defined before)

Aftermath

It’s always fun to play with bash scripts and new APIs. And this little experiment turned out to be an useful one.
If you use this hook, or if you have any ideas on how to improve it, hit me up.

A question for Asana engineers, what do you think about adding another type to the object Story, similar to a system-generated story, but for user actions on 3rd-parties? Just like this example. I’m adding this commit message as a comment to a task, but it’s not exactly a comment.
I <3 Asana..