kaije / toggl-to-jira

A simple tool for converting Toggl time entries into Jira worklog entries for a specified target date.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Toggl-to-Jira

A simple command line utility for converting Toggl time entries into Jira worklog entries for a specified target date.

There are a lot of similar projects on GitHub, but none were quite what I wanted, so I decided to write my own and get a little extra practice with TypeScript. 🙂

Usage

To use this utility, you'll need to be using Jira issue keys (e.g. STA-207) as your Toggl project names, and associating each entry you want to log to Jira with a project. Toggl entries without a project will be displayed for review, but will not be sent to Jira.

Prerequisites

Configure your credentials for Toggl and JIRA

Create a file called .env in the root of the project containing your private API tokens and your user account details as shown in the example below.

⚠️ Do not commit this file! Note that it is included in .gitignore by default.

# Set your secret API tokens here
TOGGL_API_KEY=1234567890abcdefghijklmnopq
JIRA_API_KEY=0987654321zyxabc1234567890

# Set your personal Jira account details here
JIRA_BASE_URL="https://somewhere.atlassian.net"
JIRA_USER_EMAIL="someone@somewhere.com"

# Set your personal Toggl account details here
TOGGL_WORKSPACE_ID=1234567

Install and run the utility

After cloning a local copy, run the following from the project root:

npm install

then:

npm run build

To start the utility, run:

npm start

Enter a target date in the specified format when prompted.

The script will display a list of Toggl entries found for that date, and then ask if you want to continue.

Enter 'Y' to go ahead and send these entries to Jira, or hit enter to cancel (e.g. if you'd like to clean things up a bit in Toggl before proceeding).

The tool will display a success or failure indicator for each entry sent to Jira.

Sent entries log

Sent entries are written to a local file (sent-entries.json). Provided this file is left intact and complete by the user, the tool can be safely run multiple times for the same date without the risk of duplicate work logs being sent to Jira. It will display a 'skipped' notification on screen if a corresponding entry is found in the sent entries file.

Minimum duration and rounding

Durations will be rounded to the nearest minute prior to sending, as Jira otherwise ignores the remaining seconds portion.

Any duration of less than 60 seconds (including zero seconds) will be rounded up to meet the Jira minimum of one minute.

Development

Testing

This project uses Jest and ts-jest.

To execute the tests:

npm test

Linting

This project uses ESLint for TypeScript and Prettier for linting and formatting.

To find and apply fixes:

npm run lint

Or to preview problems/fixes first without applying:

npm run lint-preview

Built with

About

A simple tool for converting Toggl time entries into Jira worklog entries for a specified target date.

License:MIT License


Languages

Language:TypeScript 100.0%