How is it possible to create a worklog description from a commit using smart commits?

Jake Arnold
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 25, 2024

This is either a question or a bug report, i'm not sure yet.

When creating worklogs via smart commits, there doesn't seem to be a way of adding the description to the worklog.

What this means is the devs have to...

  • write the commit which includes the #time element to log the time.
  • log into Jira
  • go to the project and task
  • find their worklog entry which is hard as there is no way to identify which one  if they have made multiple commits with the same duration on the same day
  • Edit the worklog entry and add the description in

With smart commits you can use the #comment option, but this is created as a comment against the task and not as the description of the worklog entry.

There is also an option in the settings for time tracking: Copying of comments to work description.  This seemed hopeful, but only when editing this setting does it then say, its only does it when a workflow transition event take place.

The next option was to use the transition with smart commits, such as #in-progress, but it  didnt update the worklog description.

Am i doing something wrong or is this not possible via smart commits?

1 answer

0 votes
Renata_Getint
Contributor
November 25, 2024

Hey @Jake Arnold

To address your question about using smart commits in Jira to create a worklog description, here’s a detailed explanation:

The Issue:

You’re attempting to use smart commits with the #time element to log time and automatically populate the worklog description. However, the worklog entries lack descriptions, and you are forced to manually update them, which is tedious.

The main challenges are:

  1. Smart commits don't inherently allow you to specify a worklog description.
  2. The #comment directive adds a comment to the task, not to the worklog description.
  3. The "Copying of comments to work description" setting only applies during workflow transitions, not during smart commits.

Is it possible to include a worklog description with smart commits?

Unfortunately, Jira’s smart commit syntax does not natively support adding descriptions to worklogs. This is a limitation in how smart commits are implemented. Currently, smart commits allow you to:

  • Log time (#time)
  • Transition issues (#<transition>)
  • Add comments (#comment) But there is no built-in syntax for attaching a description to a worklog entry.

Workarounds:

Here are a few potential approaches to address this limitation:

1. Automation for Jira (Recommended)

You can use the Automation for Jira feature to bridge the gap:

  • Create an automation rule triggered by smart commits that contain a specific pattern in the commit message (e.g., #description or a custom tag).
  • Use the automation to:
    • Parse the commit message.
    • Extract the desired description.
    • Add it to the worklog entry using the Jira REST API.

2. Custom Scripting with Jira REST API

  • Use a developer tool or a custom script to parse commit messages for additional data (like a description).
  • Write the description to the appropriate worklog using the Jira REST API:
    • POST /rest/api/3/issue/{issueIdOrKey}/worklog
    • Include the comment field in the payload to specify the worklog description.

3. Integrate with Bitbucket Pipelines

If you're using Bitbucket, consider creating a pipeline or script that intercepts commit messages, processes them for specific tags, and updates Jira worklogs programmatically.

4. Third-Party Plugins

Consider exploring Jira plugins like Worklog Assistant or Tempo Timesheets, which might offer enhanced functionality for logging time with descriptions from commits.

The "Copying of comments to work description" Setting:

You correctly noted that this setting only applies to workflow transitions. If you configure a workflow transition (e.g., using #in-progress in your commit), Jira can copy comments to the work description, but this doesn’t occur during smart commits without a transition event. This is why the setting didn’t work as expected.

Jake Arnold
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 25, 2024

Thanks @Renata_Getint 

I did try the transition with smart commits, however it didnt work either, the comment always gets written to comments and not to the worklog:

e.g.

git commit -m 'JBXI-1 #time 1h #in-review #comment testing transition worklog description'

The task did transition to In review, but nothing in the worklog description, it only appears in comments.

I'll take a look at the automation and see if this helps resolve this.

 

Like Renata_Getint likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events