Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Resolve Jira issues automatically from the commit message

Use the Git commit message to automate your Jira workflow

Automatically resolving a Jira issue from the Git (or other VCS) commit message means that the Jira issue mentioned in the commit message is transitioned at push time without manually updating the status in Jira. It's a frequent use case of DevOps automation rules that updates issues accidentally left in "In-progress" status. It takes some administrative burden off of developers and keeps your agile process on track.

For example, if your commit message is

"Fix the SAM-12 bug."

the SAM-12 issue will be automatically transitioned to "Done" status.

Follow the steps below to build your own DevOps automation rule that sends issues to "Done" status with a command in the Git (or other VCS) commit message.

The below rule is implemented with Better DevOps Automation for Jira. It's similar to Smart Commits, but more flexible and works for Data Center (Server) customers as well (who tend not to get the best DevOps automation features natively.)

Resolve Jira issues from the commit message

  1. Create a new Automation for Jira rule and select the "Commit created" trigger from the DevOps trigger category.

  2. Add a new Condition.
  3. Select the Advanced compare condition.
    3.1. Enter {{devops.commit.message}} to the First value field.
    3.2. Choose the contains regular expression option from the Condition dropdown.
    3.3. Enter (?si)(\bfix\b|\bfixes\b|\bfixed\b) to the Second value field.


  4. Save and add a "Run Groovy script" action.


  5. Add a description that clearly states what this DevOps automation rule will achieve. For example, add "Transition issue to "Done" as committer".
  6. Add this Groovy script:

    import com.atlassian.jira.component.ComponentAccessor
    def issueService = ComponentAccessor.issueService
    if (!issues) {
    def sourceStatusId = jiraHelper.getStatusByName("In Progress").iddef targetStatusId = jiraHelper.getStatusByName("Done").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 ( != sourceStatusId) {
    	try {
    		def transitionId = jiraHelper.getTransitionByTargetStatus(issue.key, Long.valueOf((String) targetStatusId)).transitionId
    		def validationResult = issueService.validateTransition(author,, transitionId as int, issueService.newIssueInputParameters())
    		if (validationResult.isValid()) {
    			def issueResult = issueService.transition(author, validationResult)
    			if ( == targetStatusId) {"${issue.key} transitioned to <${}>")
    			} 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}")

  7. Name and save your automation rule.


What you need for this DevOps automation rule

  1. Better Commit Policy for Jira
  2. Better DevOps Automation for Jira
  3. Automation for Jira

Read more on how these apps work together to create a fully flexible DevOps automation framework (using custom commands) based on Jira!

Did it work for you? Have a tricky use case? Share your questions or thoughts in the comments below! ⬇️



Log in or Sign up to comment
AUG Leaders

Atlassian Community Events