{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/jira-plugin/pulls/comments/89548884","pull_request_review_id":10094885,"id":89548884,"diff_hunk":"@@ -0,0 +1,134 @@\n+package hudson.plugins.jira.pipeline;\n+\n+import com.google.common.base.Objects;\n+import hudson.Extension;\n+import hudson.model.Action;\n+import hudson.model.Job;\n+import hudson.model.TaskListener;\n+import hudson.model.listeners.RunListener;\n+import hudson.plugins.jira.JiraSite;\n+import hudson.plugins.jira.model.JiraIssue;\n+import jenkins.branch.MultiBranchProject;\n+import org.apache.commons.lang.StringUtils;\n+import org.jenkinsci.plugins.workflow.job.WorkflowJob;\n+import org.jenkinsci.plugins.workflow.job.WorkflowRun;\n+import org.kohsuke.stapler.DataBoundConstructor;\n+import org.kohsuke.stapler.export.Exported;\n+import org.kohsuke.stapler.export.ExportedBean;\n+\n+import javax.annotation.Nonnull;\n+import javax.annotation.Nullable;\n+import java.io.IOException;\n+import java.net.URL;\n+import java.util.logging.Level;\n+import java.util.logging.Logger;\n+import java.util.regex.Matcher;\n+import java.util.regex.Pattern;\n+\n+/**\n+ * JiraJobAction is to store a reference to the {@link JiraIssue} that represents work\n+ * being done for a {@link WorkflowJob} (branch or PR) belonging to a {@link MultiBranchProject}\n+ *\n+ * Any branches with the whole key in the name or after a prefix will have this action attached.\n+ * e.g. \"JENKINS-1234\" and \"feature/JENKINS-1234\" will have this action with the issue JENKINS-1234 referenced\n+ */\n+@ExportedBean\n+public class JiraJobAction implements Action {\n+\n+    private static final Logger LOGGER = Logger.getLogger(JiraJobAction.class.getName());\n+\n+    private final Job<?, ?> owner;\n+    private final JiraIssue issue;\n+\n+    @DataBoundConstructor\n+    public JiraJobAction(Job<?, ?> owner, JiraIssue issue) {\n+        this.owner = owner;\n+        this.issue = issue;\n+    }\n+\n+    /**\n+     * @return issue representing the job\n+     */\n+    @Exported\n+    public JiraIssue getIssue() {\n+        return issue;\n+    }\n+\n+    /**\n+     * @return url of the JIRA server\n+     */\n+    @Exported\n+    @Nullable\n+    public String getServerURL() {\n+        JiraSite jiraSite = JiraSite.get(owner);\n+        URL url = jiraSite != null ? Objects.firstNonNull(jiraSite.url, jiraSite.alternativeUrl) : null;","path":"src/main/java/hudson/plugins/jira/pipeline/JiraJobAction.java","position":64,"original_position":64,"commit_id":"604648ee292553e761cab36deba7dbe138dfa60c","original_commit_id":"604648ee292553e761cab36deba7dbe138dfa60c","user":{"login":"warden","id":521838,"avatar_url":"https://avatars.githubusercontent.com/u/521838?v=3","gravatar_id":"","url":"https://api.github.com/users/warden","html_url":"https://github.com/warden","followers_url":"https://api.github.com/users/warden/followers","following_url":"https://api.github.com/users/warden/following{/other_user}","gists_url":"https://api.github.com/users/warden/gists{/gist_id}","starred_url":"https://api.github.com/users/warden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/warden/subscriptions","organizations_url":"https://api.github.com/users/warden/orgs","repos_url":"https://api.github.com/users/warden/repos","events_url":"https://api.github.com/users/warden/events{/privacy}","received_events_url":"https://api.github.com/users/warden/received_events","type":"User","site_admin":false},"body":"mmm, how about moving this to JiraSite actually?","created_at":"2016-11-24T22:05:54Z","updated_at":"2016-11-24T22:11:34Z","html_url":"https://github.com/jenkinsci/jira-plugin/pull/114#discussion_r89548884","pull_request_url":"https://api.github.com/repos/jenkinsci/jira-plugin/pulls/114","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/jira-plugin/pulls/comments/89548884"},"html":{"href":"https://github.com/jenkinsci/jira-plugin/pull/114#discussion_r89548884"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/jira-plugin/pulls/114"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/jira-plugin/pulls/114","id":95142260,"html_url":"https://github.com/jenkinsci/jira-plugin/pull/114","diff_url":"https://github.com/jenkinsci/jira-plugin/pull/114.diff","patch_url":"https://github.com/jenkinsci/jira-plugin/pull/114.patch","issue_url":"https://api.github.com/repos/jenkinsci/jira-plugin/issues/114","number":114,"state":"open","locked":false,"title":"Add JiraJobAction","user":{"login":"i386","id":50156,"avatar_url":"https://avatars.githubusercontent.com/u/50156?v=3","gravatar_id":"","url":"https://api.github.com/users/i386","html_url":"https://github.com/i386","followers_url":"https://api.github.com/users/i386/followers","following_url":"https://api.github.com/users/i386/following{/other_user}","gists_url":"https://api.github.com/users/i386/gists{/gist_id}","starred_url":"https://api.github.com/users/i386/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/i386/subscriptions","organizations_url":"https://api.github.com/users/i386/orgs","repos_url":"https://api.github.com/users/i386/repos","events_url":"https://api.github.com/users/i386/events{/privacy}","received_events_url":"https://api.github.com/users/i386/received_events","type":"User","site_admin":false},"body":"Add JiraJobAction to store a reference a JIRAIssue if a MultibranchPipeline has a branch with a issue key in its name.\r\n\r\nIt is a common pattern to include a JIRA ticket reference in a branch name like `feature/JENKINS-1234`\r\n\r\nThis action will allow us to link to it like this:\r\n![blueocean 477 2016-11-24 20-29-53](https://cloud.githubusercontent.com/assets/50156/20593070/0155a87c-b285-11e6-9e4c-94bf843a3223.png)\r\n\r\n\r\n<!-- Reviewable:start -->\r\n---\r\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/jenkinsci/jira-plugin/114)\r\n<!-- Reviewable:end -->\r\n","created_at":"2016-11-24T09:24:59Z","updated_at":"2016-11-24T22:11:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7260c8363dbf8838c828db44bc404d12aa085c6b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/jira-plugin/pulls/114/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/jira-plugin/pulls/114/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/jira-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/jira-plugin/issues/114/comments","statuses_url":"https://api.github.com/repos/jenkinsci/jira-plugin/statuses/604648ee292553e761cab36deba7dbe138dfa60c","head":{"label":"i386:topic/jira-job-action","ref":"topic/jira-job-action","sha":"604648ee292553e761cab36deba7dbe138dfa60c","user":{"login":"i386","id":50156,"avatar_url":"https://avatars.githubusercontent.com/u/50156?v=3","gravatar_id":"","url":"https://api.github.com/users/i386","html_url":"https://github.com/i386","followers_url":"https://api.github.com/users/i386/followers","following_url":"https://api.github.com/users/i386/following{/other_user}","gists_url":"https://api.github.com/users/i386/gists{/gist_id}","starred_url":"https://api.github.com/users/i386/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/i386/subscriptions","organizations_url":"https://api.github.com/users/i386/orgs","repos_url":"https://api.github.com/users/i386/repos","events_url":"https://api.github.com/users/i386/events{/privacy}","received_events_url":"https://api.github.com/users/i386/received_events","type":"User","site_admin":false},"repo":{"id":73758603,"name":"jira-plugin","full_name":"i386/jira-plugin","owner":{"login":"i386","id":50156,"avatar_url":"https://avatars.githubusercontent.com/u/50156?v=3","gravatar_id":"","url":"https://api.github.com/users/i386","html_url":"https://github.com/i386","followers_url":"https://api.github.com/users/i386/followers","following_url":"https://api.github.com/users/i386/following{/other_user}","gists_url":"https://api.github.com/users/i386/gists{/gist_id}","starred_url":"https://api.github.com/users/i386/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/i386/subscriptions","organizations_url":"https://api.github.com/users/i386/orgs","repos_url":"https://api.github.com/users/i386/repos","events_url":"https://api.github.com/users/i386/events{/privacy}","received_events_url":"https://api.github.com/users/i386/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/i386/jira-plugin","description":"Jenkins jira plugin","fork":true,"url":"https://api.github.com/repos/i386/jira-plugin","forks_url":"https://api.github.com/repos/i386/jira-plugin/forks","keys_url":"https://api.github.com/repos/i386/jira-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/i386/jira-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/i386/jira-plugin/teams","hooks_url":"https://api.github.com/repos/i386/jira-plugin/hooks","issue_events_url":"https://api.github.com/repos/i386/jira-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/i386/jira-plugin/events","assignees_url":"https://api.github.com/repos/i386/jira-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/i386/jira-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/i386/jira-plugin/tags","blobs_url":"https://api.github.com/repos/i386/jira-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/i386/jira-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/i386/jira-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/i386/jira-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/i386/jira-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/i386/jira-plugin/languages","stargazers_url":"https://api.github.com/repos/i386/jira-plugin/stargazers","contributors_url":"https://api.github.com/repos/i386/jira-plugin/contributors","subscribers_url":"https://api.github.com/repos/i386/jira-plugin/subscribers","subscription_url":"https://api.github.com/repos/i386/jira-plugin/subscription","commits_url":"https://api.github.com/repos/i386/jira-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/i386/jira-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/i386/jira-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/i386/jira-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/i386/jira-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/i386/jira-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/i386/jira-plugin/merges","archive_url":"https://api.github.com/repos/i386/jira-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/i386/jira-plugin/downloads","issues_url":"https://api.github.com/repos/i386/jira-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/i386/jira-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/i386/jira-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/i386/jira-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/i386/jira-plugin/labels{/name}","releases_url":"https://api.github.com/repos/i386/jira-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/i386/jira-plugin/deployments","created_at":"2016-11-15T00:10:27Z","updated_at":"2016-11-15T00:10:29Z","pushed_at":"2016-11-24T10:52:57Z","git_url":"git://github.com/i386/jira-plugin.git","ssh_url":"git@github.com:i386/jira-plugin.git","clone_url":"https://github.com/i386/jira-plugin.git","svn_url":"https://github.com/i386/jira-plugin","homepage":"http://jenkins-ci.org/","size":1010,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jenkinsci:master","ref":"master","sha":"10a4785a7ed2a545f7d94fe99829510343c1a960","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"repo":{"id":1163626,"name":"jira-plugin","full_name":"jenkinsci/jira-plugin","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jenkinsci/jira-plugin","description":"Jenkins jira plugin","fork":false,"url":"https://api.github.com/repos/jenkinsci/jira-plugin","forks_url":"https://api.github.com/repos/jenkinsci/jira-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/jira-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/jira-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/jira-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/jira-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/jira-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/jira-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/jira-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/jira-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/jira-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/jira-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/jira-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/jira-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/jira-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/jira-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/jira-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/jira-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/jira-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/jira-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/jira-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/jira-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/jira-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/jira-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/jira-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/jira-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/jira-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/jira-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/jira-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/jira-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/jira-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/jira-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/jira-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/jira-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/jira-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/jira-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/jenkinsci/jira-plugin/deployments","created_at":"2010-12-13T05:42:51Z","updated_at":"2016-11-07T16:44:27Z","pushed_at":"2016-11-24T17:24:18Z","git_url":"git://github.com/jenkinsci/jira-plugin.git","ssh_url":"git@github.com:jenkinsci/jira-plugin.git","clone_url":"https://github.com/jenkinsci/jira-plugin.git","svn_url":"https://github.com/jenkinsci/jira-plugin","homepage":"http://jenkins-ci.org/","size":9065,"stargazers_count":72,"watchers_count":72,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":162,"mirror_url":null,"open_issues_count":4,"forks":162,"open_issues":4,"watchers":72,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/jira-plugin/pulls/114"},"html":{"href":"https://github.com/jenkinsci/jira-plugin/pull/114"},"issue":{"href":"https://api.github.com/repos/jenkinsci/jira-plugin/issues/114"},"comments":{"href":"https://api.github.com/repos/jenkinsci/jira-plugin/issues/114/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/jira-plugin/pulls/114/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/jira-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/jira-plugin/pulls/114/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/jira-plugin/statuses/604648ee292553e761cab36deba7dbe138dfa60c"}}}}
{"actor":{"display_login":"warden"}}