{jenkins-plugin-info:github-issues}

GitHub Issues Plugin

This plugin allows you to create a GitHub issue whenever your build fails. Once the build starts passing again, the issue will automatically be closed.

Report bugs here: http://dl.vc/jenkins-github-issues-bug (you will need to first create a Jenkins account at https://accounts.jenkins.io/)

Getting Started

In Manage Jenkins → Configure System → GitHub → GitHub Servers, ensure at least one GitHub server is configured and the "Test connection" button works.

Once this has been configured, add "Create GitHub issue on failure" as a post-build action:

When your build fails, a GitHub issue will be opened.

Customization

The default template used for the issue title and body can be changed in the GitHub Issue Notifier section in the Jenkins settings:

This template can also be modified per job. The "Content Token Reference" section at the bottom of the settings pane can be used to get information about all the available tokens.

Advanced Usage

Usage with job-dsl

When using the great job-dsl plugin, you can configure a publisher step as follows:

job(String name) {
  publishers {
    gitHubIssueNotifier {
    }
  }
}

All the advanced settings are available as optional configuration properties. To see all the available properties, go to the Job DSL API viewer at JENKINS_URL/plugin/job-dsl/api-viewer/index.html and search for gitHubIssueNotifier.

Automating global configuration

You can modify the global config using a system groovy script, i.e. add a init.groovy to the JENKINS_HOME dir.

import org.jenkinsci.plugins.githubissues.GitHubIssueNotifier
def descriptor = Jenkins.instance.getDescriptorByType(GitHubIssueNotifier.DescriptorImpl)
descriptor.issueTitle = 'ISSUE TITLE TEMPLATE`
descriptor.issueBody = 'ISSUE BODY TEMPLATE`
descriptor.issueLabel = 'LABELA LABELB`
descriptor.save()

In the templates you can use all available tokens using ${TOKEN} notation. To see all available tokens, click the help button on the right of the `Content Token Reference` label in the GitHub Issues section of the global configuration UI.

To configure the global GitHub config and the credential config, see the init.groovy example in the repo.

Usage in a Jenkinsfile

Configure a publisher step in a Jenkinsfile as follows:

script {
    properties([[$class: 'GithubProjectProperty',
                projectUrlStr: '<GitHub repo URL>']])
}

...

step([$class: 'GitHubIssueNotifier',
      issueAppend: true,
      issueLabel: '',
      issueTitle: '$JOB_NAME $BUILD_DISPLAY_NAME failed'])

Changelog

1.2.4 - 4th November 2017

1.2.3 - 22nd July 2017

1.2.2 - 4th March 2017

1.2.1 - 26th February 2017

1.2 - 26th November 2016

1.1 - 12th November 2016

1.0 - 5th November 2016