Class: Danger::DangerJiraSync
- Inherits:
-
Plugin
- Object
- Plugin
- Danger::DangerJiraSync
- Defined in:
- lib/jira_sync/plugin.rb
Overview
Jira and GitHub should be friends, and Danger brings them closer together with jira_sync
Defined Under Namespace
Classes: NotConfiguredError
Instance Method Summary collapse
-
#autolabel_pull_request(issue_prefixes) ⇒ Array<String>?
Labels the Pull Request with Jira Project Keys and Component Names.
-
#configure(jira_url:, jira_username:, jira_api_token:) ⇒ JIRA::Client
Configures the Jira REST Client with your credentials.
Instance Method Details
#autolabel_pull_request(issue_prefixes) ⇒ Array<String>?
Labels the Pull Request with Jira Project Keys and Component Names
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/jira_sync/plugin.rb', line 68 def autolabel_pull_request(issue_prefixes) raise NotConfiguredError unless @jira_client raise(ArgumentError, "issue_prefixes cannot be empty") if issue_prefixes.empty? issue_keys = extract_issue_keys_from_pull_request(issue_prefixes) return if issue_keys.empty? labels = fetch_labels_from_issues(issue_keys) return if labels.empty? create_missing_github_labels(labels) add_labels_to_issue(labels) labels end |
#configure(jira_url:, jira_username:, jira_api_token:) ⇒ JIRA::Client
Configures the Jira REST Client with your credentials
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/jira_sync/plugin.rb', line 45 def configure(jira_url:, jira_username:, jira_api_token:) warn "danger-jira_sync plugin configuration is missing jira_url" if jira_url.blank? warn "danger-jira_sync plugin configuration is missing jira_username" if jira_username.blank? warn "danger-jira_sync plugin configuration is missing jira_api_token" if jira_api_token.blank? @jira_client = JIRA::Client.new( site: jira_url, username: jira_username, password: jira_api_token, context_path: "", auth_type: :basic ) end |