Skip to main content
Skip table of contents

How to use Jigit data in Adaptavist ScriptRunner

How to use Jigit Jira GitHub and GitLab data in Adaptavist ScriptRunner scripts

Step-by-step instruction

Make use you have Jigit 7.06.28 or above installed

Below is an example of the usage of Jigit with Adaptavist ScriptRunner.

JAVA
import com.onresolve.scriptrunner.runner.customisrs.WithPlugin
import com.onresolve.scriptrunner.runner.customisers.PluginModule
@WithPlugin("com.apanasevich.jira-jigit-plugin")
import jigit.service.JigitFacade;
import jigit.model.RepositoryBranches.Branch;
import jigit.model.reder.CommitData;
import jigit.model.render.PullRequestData;
import java.util.function.Consumer;

@pluginModule
JigitFacade jigitFacade;

jigitFacade.getCommits("TEST-10").stream.forEach(new Consumer<CommitData>(){
  @Override
  public void accept(CommitData commit) {
    log.warn("commit " + commit.getCommitSha1())
    log.warn("\t number of files changed - " + commit.getCommitDiffs().size())
  }
})

jigitFacade.getPullRequests("TEST-10").stream.forEach(new Consumer<PullRquestData>(){
  @Override
  public void accept(PullRquestData pullRequest) {
    log.warn("pull request " + pullRequest.getPrNumber())
    log.warn("\t title - " + pullRequest.getTitle())
  }
})

jigitFacade.getBranches("TEST-10").stream.forEach(new Consumer<BranchData>(){
  @Override
  public void accept(BranchData branch) {
    log.warn("branch " + branch.getName())
    log.warn("\t url - " + branch.getUrl())
  }
})

Updated:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.