Class: Geet::Services::CreateIssue
- Inherits:
-
Object
- Object
- Geet::Services::CreateIssue
- Includes:
- Helpers::OsHelper
- Defined in:
- lib/geet/services/create_issue.rb
Instance Method Summary collapse
-
#execute(repository, title, description, options = {}) ⇒ Object
options: :label_patterns :assignee_patterns :no_open_issue.
Methods included from Helpers::OsHelper
Instance Method Details
#execute(repository, title, description, options = {}) ⇒ Object
options:
:label_patterns
:assignee_patterns
:no_open_issue
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/geet/services/create_issue.rb', line 16 def execute(repository, title, description, = {}) if [:label_patterns] puts 'Finding labels...' all_labels = repository.labels selected_labels = select_entries(all_labels, [:label_patterns], type: 'labels') end if [:assignee_patterns] puts 'Finding collaborators...' all_collaborators = repository.collaborators assignees = select_entries(all_collaborators, [:assignee_patterns], type: 'collaborators') end puts 'Creating the issue...' issue = repository.create_issue(title, description) if selected_labels puts 'Adding labels...' issue.add_labels(selected_labels) puts '- labels added: ' + selected_labels.join(', ') end if assignees puts 'Assigning users...' issue.assign_user(assignees) puts '- assigned: ' + assignees.join(', ') else issue.assign_user(repository.authenticated_user) end if [:no_open_pr] puts "Issue address: #{issue.link}" else os_open(issue.link) end end |