Skip to content

Setup CI

Edouard Chin edited this page Jul 18, 2019 · 2 revisions

🤖 SmartTodo is meant to be run on your CI alongside your tests. However, each time a new CI build is triggered, it will potentially send a Slack message to TODO's assignees in case their TODO is expired. If you work in a large organisation and trigger thousands of CI builds per day, I let you imagine ...

This is why running the SmartTodo command line without the ENABLE_SMART_TODO environment variable, won't do anything.


CI Schedule ⏲

Instead, SmartTodo was meant to be run on your CI on a schedule. Most, if not all CI (Travis, Circle CI, Buildkite ...) have the ability to trigger builds on a schedule.

When configuring your schedule, you should have a way to export environment variables only for scheduled builds, not regular ones. This is where you should export the ENABLE_SMART_TODO environment variable. Refer to your CI provider documentation to know how to setup a schedule.


Secrets ⏲

SmartTodo also needs a Slack token in order to send message to TODO assignees. Refer to the Slack Token page to know how to get a Slack token with the needed scopes.

You have two ways to provide the SmartTodo CLI the token.

  1. Pass it to the command line options: smart_todo --slack_token <your_token> --fallback_channel '#general'
  2. Export the SMART_TODO_SLACK_TOKEN env variable: SMART_TODO_SLACK_TOKEN=1 smart_todo --fallback_channel '#general'

Depending on your CI, one or the other can be more convenient.

⚠️ Please make sure your token is safe and not exposed to the outside world. Please refer to your CI provider to know how to expose secrets for your builds in a safe manner.


Here is an example of a schedule configured on Buildkite 📷
Screenshot 2019-07-19 at 01 06 15
Clone this wiki locally