Our business uses Harvest for project time-tracking. Try as I might, I struggle to reconcile my inclination to focus on technical challenges, with the need to stay on top of all the work that’s happening. This is a simple project to send myself a regular project budget-status email, so it is always front of mind. It uses the Harvest API, and Github Actions for automation.
Fork this repository! It should run as-is, after configuration.
You will need to create a personal access token for the API. Note that some API calls require admin privileges (I haven’t checked against a project-manager role). It is also worth noting the overview page. This script will include your configured email address in the User-Agent header as they require.
You will need to create the following secrets for the action:
Secret Name | Description |
---|---|
HARVEST_ID | The company account ID |
HARVEST_TOKEN | The personal access token you created |
ACCOUNT_EMAIL | The address that will receive (and send) this email. Will also be used in the User-Agent. |
SMTP_USERNAME | The gmail (hardcoded) email address; may be the same as ACCOUNT_EMAIL |
SMTP_PASSWORD | The gmail password associated. (May be an application password) |
It uses Mako Templates if you need to edit the email output (and you probably do, not much attention has been paid there yet).
The two API calls used are:
- https://api.harvestapp.com/v2/users/me/project_assignments for my personal projects (seems to be undocumented?)
- A listing of active projects: https://api.harvestapp.com/v2/reports/project_budget?is_active=true
Check privileges needed as appropriate.
The schedule is currently hard-coded as well, and you probably want to change that.
You have two options when creating the initial HarvestAPI
object;
pass it a dictionary with your configuration variables above (it
only needs the first three), or by default it will load from the
environment. I prefer the latter, using direnv (the .envrc
file
is in .gitignore
). It also has Emacs support.
- [ ] Styling! For eg, percentage bar-plot, colour based on how close to the budget we are, etc.
- [ ] Add linking through to individual projects