One of the best parts of working for Asana is workingΒ inΒ Asana. Asana teams and employees are fully bought into the Asana product, and nearly everything we do is tracked within Asana. Itβs very common for newly hired employees to experience a bit of culture shock when they find out that it would be almost unheard of to receive an email from another Asana employee!
On the Engineering team, one of the most common workflows is reviewing and discussing code changes. We use Github to host our repositories, and use Github Pull Requests for code reviews. Code review is a major part of a Software Engineerβs job. Since Asana is the best way to keep track of tasks and make it clear who is doing what by when, it makes sense that we track code reviews within Asana. Since Asana Engineers rarely check their emails, the Github email notifications would largely go unnoticed.
To track code reviews in Asana, we wroteΒ SGTMΒ (Sounds Good To Me), anΒ open-sourceΒ app.
SGTM operates as aΒ Github WebhookΒ that functions as a one-way sync from Github Pull Requests to Asana tasks. There are many benefits we get from this sync from Github βAsana:
It can sometimes be ambiguous what the next action item is after a review. At Asana, we value having theΒ clarityΒ of who is doing what by when. So when someone is assigned a Pull Request, an Asana task gets assigned to them. Once reviewed and approved or changes are requested, the Asana task gets assigned back to the author of the Pull Request, letting them know that they are responsible for the next step.
SGTM automatically sets the due date based onΒ RulesΒ that match our internal expectations of when code reviews should be addressed.
Having the Pull Request comments in Asana lets us use Asana to search for historical context and use the Asana Work Graph to search through pull request comments and descriptions without leaving our tool.
Not everyone has access to the codebase, but there may be a discussion in the Pull Request that pertains to them. In Asana, those individuals can be added as collaborators on the task to follow the conversation even if they donβt have a Github account. This way, Engineers can keep Product Managers, Designers, and others in the loop without broadening the scope of people who have access to our source code.
SGTM integrates into the workflow that works best for us, which of course is Asana!
Weβve added features to SGTM so that it also has the ability to:
Optionally auto-merge the Pull Request once approved and tests pass (based on Github labels)
Optionally complete relevant Asana tasks once the Pull Request has been merged
β¦ and more to come! (See below.)
SGTM is written in Python, and usesΒ Asanaβs APIΒ alongsideΒ GitHubβs GraphQL APIΒ to connect the two platforms together, along with a few AWS services to run the app and maintain state. Some of these AWS services are S3, Lambda, DynamoDb, API Gateway, and Cloudwatch. The full infrastructure of the app can be foundΒ here.
To share a self-hosted application with the world, we useΒ TerraformΒ to manage and deploy the application and infrastructure. This way, we can open source and share the code as well as the infrastructure behind the code.
Hereβs an example GitHub Pull Request that an Engineer would open:
Notice that the bottom of the description notes, βPull Request synchronized with Asana taskβ. That message is auto-generated by SGTM once the Asana task is created. Now letβs take a look at what the task looks like in Asana:
After a review, the comments (including inline comments) get synchronized back to the Asana task as comments, and can the task can be re-assigned back to the author for next steps.
If SGTM sounds like something your team would be excited to use, head over toΒ https://github.com/Asana/SGTM#setupΒ for instructions on how to set up the app for your own repository! Weβre also happy to take feature requests and pull requests to improve SGTM and add new functionality.