markhepburn / harvest_email

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overview

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.

Want to run your own?

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 NameDescription
HARVEST_IDThe company account ID
HARVEST_TOKENThe personal access token you created
ACCOUNT_EMAILThe address that will receive (and send) this email. Will also be used in the User-Agent.
SMTP_USERNAMEThe gmail (hardcoded) email address; may be the same as ACCOUNT_EMAIL
SMTP_PASSWORDThe 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:

Check privileges needed as appropriate.

The schedule is currently hard-coded as well, and you probably want to change that.

Local Development

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

About


Languages

Language:Smarty 55.2%Language:Python 44.8%