Automate your time logging by utilizing Git hooks and Jira API.
- Assuming you work on feature branches please create them in format
(feature|fix|path|...)/EXAMPLE-123-some-desc
. - Install and use
commit-msg
Git hook from https://github.com/pbetkier/add-issue-id-hook to add Jira issue to every commit on a branch. - Collect all commits from all the repositories in one text file (
commit-log.txt
) using the followingpost-commit
Git hook: https://gist.github.com/lmullen/6095650 - Run
Jira time logger
periodically to readcommit-log.txt
from previous point and update worklogs using Jira API.
graph TD;
A["User is on branch /foo-EXMP-123"] --> B["User commits with message #quot;My work#quot;"];
B --> C["Commit is renamed to #quot;EXMP-123 My work#quot;"];
C-->D["Commit text is appended to the `commit-log.txt`"];
graph TD;
A["Read `commit-log.txt`"] --> B["Parse `commit-log.txt` into list of days with Jira issues"];
B --> C["Check how much time is logged already on a given day"];
C-->D["Divide remaining time into Jira issues for that day"];
D-->E["Log time for that issues"]
Building:
./gradlew build
To run this script you need to pass your Jira instance address, user, and password or token:
./gradlew bootRun --args='--jira.host=https://jira.instance.com --jira.user=yourusername --jira.password=your-password/token'
To have Git hooks in every repository you work with make use of git templates: https://coderwall.com/p/jp7d5q/create-a-global-git-commit-hook