@@ -66,35 +66,7 @@ def build_config(self) -> dict:
66
66
'use_atlassian_document_format' : self .jira_use_atlassian_document_format if isinstance (self .jira_use_atlassian_document_format , bool ) else self .get_boolean (self .jira_use_atlassian_document_format ),
67
67
'create_sub_tasks' : self .jira_create_sub_tasks if isinstance (self .jira_create_sub_tasks , bool ) else self .get_boolean (self .jira_create_sub_tasks )
68
68
}
69
- }
70
-
71
- # # If JSON config variable exists
72
- # def check_if_json_key_value_exists(self, key: str, config: dict, existing_value):
73
-
74
- # if key in config.keys(): # Only works for flat JSON files
75
- # if key != 'default_issue_labels':
76
- # return config[key]
77
- # else:
78
- # if environ[key] == '':
79
- # return []
80
- # else:
81
- # environ[key].split(',')
82
- # else:
83
- # return existing_value
84
-
85
- # # If environment variable exists
86
- # def check_if_env_var_exists(self, env_key: str, existing_value):
87
-
88
- # if env_key in environ:
89
- # if env_key != 'default_issue_labels':
90
- # return environ[env_key]
91
- # else:
92
- # if environ[env_key] == '':
93
- # return []
94
- # else:
95
- # environ[env_key].split(',')
96
- # else:
97
- # return existing_value
69
+ }
98
70
99
71
# Load the config.json file from the current working directory, or from the GITHUB_WORKSPACE environment variable if running inside GitHub Actions
100
72
def load_config_file (self ) -> dict :
@@ -132,16 +104,6 @@ def load_config_file(self) -> dict:
132
104
133
105
if self .config .jira .create_sub_tasks == None :
134
106
self .config .jira .create_sub_tasks = False # Default is false
135
-
136
- # self.builder.validate_field_type('config.input.type', str)
137
- # self.builder.validate_field_type('config.input.format', str)
138
- # self.builder.validate_field_type('config.jira.cloud_url', str)
139
- # self.builder.validate_field_type('config.jira.project_key', str)
140
- # self.builder.validate_field_type('config.jira.auth_email', int)
141
- # self.builder.validate_field_type('config.jira.api_token', str)
142
- # self.builder.validate_field_type('config.jira.default_issue_labels', list)
143
- # self.builder.validate_field_type('config.jira.use_atlassian_document_format', bool)
144
- # self.builder.validate_field_type('config.jira.create_sub_tasks', bool)
145
107
146
108
self .logger .debug ('Config from the config.json file - ' + str (self .config ))
147
109
return self .config .to_dict () if isinstance (self .config , config_node .Config ) else self .config
@@ -228,38 +190,10 @@ def load_config_env(self) -> dict:
228
190
229
191
except Exception as e :
230
192
self .logger .error ('Error loading environment variables: ' + str (traceback .print_tb (e .__traceback__ )))
231
-
232
- # self.input_type = self.check_if_env_var_exists(env_key='input_type', existing_value=self.input_type)
233
- # self.input_format = self.check_if_env_var_exists(env_key='input_format', existing_value=self.input_format)
234
- # self.jira_cloud_url = self.check_if_env_var_exists(env_key='jira_cloud_url', existing_value=self.jira_cloud_url)
235
- # self.jira_project_key = self.check_if_env_var_exists(env_key='jira_project_key', existing_value=self.jira_project_key)
236
- # self.auth_email = self.check_if_env_var_exists(env_key='jira_auth_email', existing_value=self.auth_email)
237
- # self.api_token = self.check_if_env_var_exists(env_key='jira_api_token', existing_value=self.api_token)
238
- # self.default_issue_labels = self.check_if_env_var_exists(env_key='jira_default_issue_labels', existing_value=self.default_issue_labels)
239
- # self.use_atlassian_document_format = self.check_if_env_var_exists(env_key='jira_use_atlassian_document_format', existing_value=self.use_atlassian_document_format)
240
- # self.create_sub_tasks = self.check_if_env_var_exists(env_key='jira_create_sub_tasks', existing_value=self.create_sub_tasks)
241
193
242
194
def get_combined_config (self , config_file : dict , config_env : dict ) -> dict :
243
195
244
196
try :
245
- # merged_config = config_env | config_file
246
- # self.logger.debug('Final Config Object - ' + str(merged_config))
247
- # return merged_config
248
-
249
- # for k in set(config_file.keys()).union(config_env.keys()):
250
- # if k in config_file and k in config_env:
251
- # if isinstance(config_file[k], dict) and isinstance(config_env[k], dict):
252
- # yield (k, dict(self.get_combined_config(config_file[k], config_env[k])))
253
- # else:
254
- # # If one of the values is not a dict, you can't continue merging it.
255
- # # Value from second dict overrides one in first and we move on.
256
- # yield (k, config_env[k])
257
- # # Alternatively, replace this with exception raiser to alert you of value conflicts
258
- # elif k in config_file:
259
- # yield (k, config_file[k])
260
- # else:
261
- # yield (k, config_env[k])
262
-
263
197
return merge (config_file , config_env )
264
198
265
199
except Exception as e :
0 commit comments