A Jira issue is often left in "To Do" when developers start working on a task and forget to update the issue. This makes the Scrum board or product roadmap unreliable and can mislead product managers.
You can take this administrative work off of developers' shoulders with automation. Create a Jira automation rule that automatically transitions a Jira issue from "To Do" to "In Progress" on the first commit!
An added bonus: the below automation will perform the issue transition on behalf of the committer, instead of an "automation agent".
This DevOps automation rule will transition a Jira issue left in "To Do" to "In Progress" when the first commit is created.
import com.atlassian.jira.component.ComponentAccessor def issueService = ComponentAccessor.issueService if (!issues) { return } def sourceStatusId = jiraHelper.getStatusByName("To Do").iddef targetStatusId = jiraHelper.getStatusByName("In Progress").id def author = devops.committerByUsername ?: {throw new IllegalArgumentException("No user found with username \"${devops.commit.username}\"")}() // def author = devops.committerByEmailAddress ?: {throw new IllegalArgumentException("No user found with email address \"${devops.commit.emailAddress}\"")}() // (alternative, see the Smart Value Reference!)issues.forEach { issue -> if (issue.status.id != sourceStatusId) { return } try { def transitionId = jiraHelper.getTransitionByTargetStatus(issue.key, Long.valueOf((String) targetStatusId)).transitionId def validationResult = issueService.validateTransition(author, issue.id, transitionId as int, issueService.newIssueInputParameters()) if (validationResult.isValid()) { def issueResult = issueService.transition(author, validationResult) if (issueResult.issue.status.id == targetStatusId) { auditLog.info("${issue.key} transitioned to <${issueResult.issue.status.name}>") } else { auditLog.error("${issue.key} not transitioned! (check the workflow configuration!)") } } else { (validationResult.errorCollection.errors.collect { "<${it.key}> field error: ${it.value}" } + validationResult.errorCollection.errorMessages).each { auditLog.error(it) } } } catch (Exception e) { auditLog.error(e.message ?: "${e} ${e.stackTrace}") } }
Now if a Jira issue in "To Do" status is mentioned in the commit message, it will be automatically transitioned to "In Progress"! If you look at the History of the issue, you can see that the issue was transitioned by the committer user.
The mentioned issue was transitioned in the name of the committer user
This transition only happens once, for the first commit that mentions this issue. Also, it only happens between “To Do” and “In Progress” statuses in this exact direction. No “Done” issues will be moved to “In Progress” again.
Why do I need to install these apps, you wonder? Read more on how these apps work together to create a fully flexible DevOps automation framework based on Jira!
This automation rule for transitioning an issue from "To Do" to "In Progress" is just the tip of the iceberg. You can achieve much more with DevOps Automation for Jira!
Discover the Genius Commits and how they compare to Bitbucket Smart Commits!
Genius Commits carry special commands in the commit message. You can trigger any automation action with them, like running a CI/CD build, tests, Slack notifications, Jira issue operations, and much more!
You can even create your custom command or use many built-in commands to trigger the DevOps action you need for free!
Have questions or a tricky use case? Ask in the comments below! ⬇️
Levente Szabo _Midori_
Digital Marketing and Customer Success
Midori
Budapest
47 accepted answers
0 comments