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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

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
4,556,459
Community Members
 
Community Events
184
Community Groups

how to access Issue development field information (such commits)

I want to read issue Development field information (commits) with groovy post function script

the  plugin  com.atlassian.jira.plugin.devstatus.api.DevStatusSummaryService seems to not be no more  available.

we use the JDC 8.20.0 version server

Can someone advise how to do this?

1 answer

1 accepted

1 vote
Answer accepted
At the end I found the answer to my question.
using following groovy script
================================================
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.jira.plugin.devstatus.api.DevStatusSummaryService
import com.atlassian.plugin.module.ContainerManagedPlugin
import com.atlassian.plugin.PluginState
def getCommitsList(Issue issue){
    Map commitsMap = [:]
    @WithPlugin('com.atlassian.jira.plugins.jira-development-integration-plugin')
    DevStatusSummaryService devStatusSummaryService = null

    def plugin = ComponentAccessor.pluginAccessor.getPlugin("com.atlassian.jira.plugins.jira-development-integration-plugin")
    def currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
    if (plugin instanceof ContainerManagedPlugin && plugin.pluginState == PluginState.ENABLED) {
        def beans = plugin.getContainerAccessor().getBeansOfType(DevStatusSummaryService)
        if (beans.size() > 0) {
            devStatusSummaryService = beans.first()
        }
    }
    def data = devStatusSummaryService.getDetailData(issue.id, "githube", "repository", currentUser).right().get()
    def items = data['detail']['repositories']
    items.each{ repos->   
        repos.each {repo->
            repo.each{ commits->      
                commits.each {commit->
                    def commit_sha = commit["displayId"]
                    def commit_url = commit["url"]            
                    commitsMap.put(commit_sha ,commit_url);
                }
            }
        }
    }
    return commitsMap
}
================================================

Thanks a lot, it helped me very much! Now I can get set of commit authors

    def items = data['detail']['repositories']
    items.each{ repos->
        repos.each {repo->
            repo.each{ commits->
                commits.each {commit->
                    if (commit["message"].toString().contains(issue.key)){
                        def authorName = commit["author"]["name"]
                        authors.add(authorName)
                    }
                }
            }
        }
    }
    return authors as Set

Suggest an answer

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

Atlassian Community Events