gitlab_support_readiness 1.0.86 → 1.0.88

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 849c69934c1a08ad5f0aebf4c7d76603ffa71a15335485fa2a786e31e187ac4e
4
- data.tar.gz: 6bece7519407c6e398fe2b5127ed2558f8ef0ab55690dcea1957f66b0ab67868
3
+ metadata.gz: 1e9057a70ad9cef062f6a7f361ea61039f315e0b2aa3f25737947dc94f018339
4
+ data.tar.gz: bfc92891940e54725a794db15f49b67f4f6d44a03925fa70966ef1ecb26267b2
5
5
  SHA512:
6
- metadata.gz: 4f2bbab55afdec7bcfb39621747d96341feed2cd93650ea64af260d67c4182918a4467dbe6f0a649a96c2a8567d86db9fc545297f78a18d7fc6852533d1ca355
7
- data.tar.gz: 7736d26f017d16a35771c9bdacd412765e8404471b081a4a0c0f2e9f7b9d1b13e1eeb4cf09016c6b25a3637eaae048733197c8e39d53f3f1d2cb2c23a2c4a367
6
+ metadata.gz: 6993482077689597bab8f3b5d5867602075bb6b8abb36c684a6a813b501bd8a996b3f0e437e91c143a46b2c5608ca5b49a1abd4c1cfedb8ad9352188ca119bbf
7
+ data.tar.gz: 683c8a3ac2efce0c6b5b61f78478cf3bae2029fcd43f6f6a679887b5bd292f46359c22e3f23ad097071234291006963fba96b99cbef972c03ff1e10a0d7f020c
@@ -58,9 +58,9 @@ module Readiness
58
58
  end
59
59
  end
60
60
  zd_options.each do |zd_option|
61
- repo_option = repo.custom_field_options.detect { |rp_o| rp_o.name == zd_option.name }
61
+ repo_option = repo.custom_field_options.detect { |rp_o| rp_o.value == zd_option.value }
62
62
  if repo_option.nil?
63
- @diffs[:option_deletes].push({ "#{repo.title}" => zd_option })
63
+ @diffs[:option_deletes].push({ "#{repo.value}" => zd_option })
64
64
  end
65
65
  end
66
66
  end
@@ -25,9 +25,123 @@ module Readiness
25
25
  issue.description = message(file_path)
26
26
  create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue)
27
27
  puts "Issue created: #{create.web_url}"
28
+ create_yaml_file(create, file_path) if advanced == 'no'
28
29
  exit 0
29
30
  end
30
31
 
32
+ ##
33
+ # Create the macro YAML file
34
+ #
35
+ # @author Jason Colyer
36
+ # @since 1.0.88
37
+ def self.create_yaml_file(issue, path)
38
+ macro_project_id = if instance == 'Zendesk Global'
39
+ 53382019
40
+ else
41
+ 53561342
42
+ end
43
+ macro_project = Readiness::GitLab::Projects.find!(@gitlab_client, macro_project_id)
44
+ commit_params = {
45
+ branch: 'master',
46
+ commit_message: 'Creating new macro',
47
+ actions: [
48
+ {
49
+ file_path: path,
50
+ content: yaml_contents,
51
+ action: 'create'
52
+ }
53
+ ]
54
+ }
55
+ Readiness::GitLab::Repositories.create_commit!(@gitlab_client, macro_project, commit_params)
56
+ comment_params = {
57
+ body: macro_created_message
58
+ }
59
+ comment = Readiness::GitLab::Issues.create_comment!(@gitlab_client, project, issue, comment_params)
60
+ end
61
+
62
+ ##
63
+ # Return a String for a macro creation comment
64
+ #
65
+ # @author Jason Colyer
66
+ # @since 1.0.88
67
+ def self.macro_created_message
68
+ <<~STRING
69
+ Greetings @#{requester.username} !
70
+
71
+ Your macro has now been created on the #{instance} instance. Keep in mind a hard refresh of your Zendesk tab might be required to see the macro listed.
72
+
73
+ If using a managed content file for this new macro and you had not populated it before your submission, a placeholder file was created for you (and you will need to make a MR on it to update the macro's wording).
74
+
75
+ If you have any problems, please reopen this issue and ping the Support Readiness team for assistance.
76
+
77
+ /label ~"Readiness::Completed"
78
+
79
+ /close
80
+ STRING
81
+ end
82
+
83
+ ##
84
+ # Sets the contents for a YAML file
85
+ #
86
+ # @author Jason Colyer
87
+ # @since 1.0.88
88
+ def self.yaml_contents
89
+ {
90
+ 'title' => name,
91
+ 'active' => true,
92
+ 'description' => '',
93
+ 'actions' => determine_actions,
94
+ 'restriction' => nil,
95
+ 'contains_managed_content' => (comment != 'none')
96
+ }.to_yaml
97
+ end
98
+
99
+ ##
100
+ # Determine the actions for a YAML file
101
+ #
102
+ # @author Jason Colyer
103
+ # @since 1.0.88
104
+ def self.determine_actions
105
+ actions = []
106
+ if ticket_state != 'none'
107
+ actions.push({ 'field' => 'status', 'value' => ticket_state })
108
+ end
109
+ if assignee == 'Unassign'
110
+ actions.push({ 'field' => 'assignee_id', 'value' => '' })
111
+ end
112
+ if assignee == 'Current User'
113
+ actions.push({ 'field' => 'assignee_id', 'value' => 'current_user' })
114
+ end
115
+ if tag != 'None'
116
+ actions.push({ 'field' => 'current_tags', 'value' => tag })
117
+ end
118
+ if comment == 'Public'
119
+ actions.push({ 'field' => 'comment_mode_is_public', 'value' => true })
120
+ end
121
+ if comment == 'Private'
122
+ actions.push({ 'field' => 'comment_mode_is_public', 'value' => false })
123
+ end
124
+ actions
125
+ end
126
+
127
+ ##
128
+ # Sets the global variable ticket_state
129
+ #
130
+ # @author Jason Colyer
131
+ # @since 1.0.88
132
+ def self.ticket_state
133
+ @ticket_state ||= ENV.fetch('CREATE_MACRO_STATE', 'none')
134
+ end
135
+
136
+ ##
137
+ # Sets the global variable advanced
138
+ #
139
+ # @author Jason Colyer
140
+ # @since 1.0.88
141
+ def self.advanced
142
+ @advanced ||= ENV.fetch('CREATE_MACRO_ADVANCED', 'yes')
143
+ end
144
+
31
145
  def self.create_macro_file_if_needed
32
146
  return nil if comment == 'none'
33
147
 
@@ -161,6 +275,7 @@ module Readiness
161
275
  - Assigne change: #{assignee}
162
276
  - Tag to add: #{tag}
163
277
  - Type of comment: #{comment}
278
+ - Ticket state to set: #{ticket_state}
164
279
  - Managed content file: #{file_path.nil? ? 'N/A' : file_path}
165
280
 
166
281
  Some other details are:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_support_readiness
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.86
4
+ version: 1.0.88
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Colyer