Skip to content

Commit 77358ba

Browse files
Merge pull request #5 from GeorgeDavis-Ibexlabs/github-actions
fix: Handling INPUT variables logic when running within GitHub Actions
2 parents 972be36 + b80f2a6 commit 77358ba

File tree

1 file changed

+35
-11
lines changed

1 file changed

+35
-11
lines changed

config_handler/config_handler.py

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,13 @@ def load_config_env(self) -> dict:
157157

158158
temp_list = []
159159
for config_key, config_value in ConfigKeyValuePair.items():
160+
161+
if 'GITHUB_ACTIONS' in environ.keys():
162+
if environ['GITHUB_ACTIONS']:
163+
config_key = 'INPUT_' + config_key
164+
160165
if config_key in environ.keys():
166+
self.logger.debug('Config found within environment variables - ' + str(config_key) + ' - ' + str(config_value))
161167
temp_list.append(config_value)
162168

163169
self.logger.debug('ConfigMap JSON key values found within environment variables - ' + str(temp_list))
@@ -184,21 +190,39 @@ def load_config_env(self) -> dict:
184190
for item in reversed(item_path):
185191
# temp_config_dict.update({item: environ[list_item.replace('.', '_').upper()]})
186192
# break
187-
if list_item == 'jira.default_issue_labels':
188-
temp_config_dict.update({
189-
item: environ[list_item.replace('.', '_').upper()].split(',')
190-
})
193+
if 'GITHUB_ACTIONS' in environ.keys():
194+
if environ['GITHUB_ACTIONS']:
195+
if list_item == 'INPUT_jira.default_issue_labels':
196+
temp_config_dict.update({
197+
item: environ[list_item.replace('.', '_').upper()].split(',')
198+
})
199+
else:
200+
if list_item in ['INPUT_jira.use_atlassian_document_format', 'INPUT_jira.create_sub_tasks']:
201+
temp_config_dict.update({
202+
item: self.get_boolean(environ[list_item.replace('.', '_').upper()])
203+
})
204+
else:
205+
temp_config_dict.update({
206+
item: environ[list_item.replace('.', '_').upper()]
207+
})
208+
config.update({list_item.split('.')[0].replace('INPUT_',''): temp_config_dict})
209+
break
191210
else:
192-
if list_item in ['jira.use_atlassian_document_format', 'jira.create_sub_tasks']:
211+
if list_item == 'jira.default_issue_labels':
193212
temp_config_dict.update({
194-
item: self.get_boolean(environ[list_item.replace('.', '_').upper()])
213+
item: environ[list_item.replace('.', '_').upper()].split(',')
195214
})
196215
else:
197-
temp_config_dict.update({
198-
item: environ[list_item.replace('.', '_').upper()]
199-
})
200-
break
201-
config.update({list_item.split('.')[0]: temp_config_dict})
216+
if list_item in ['jira.use_atlassian_document_format', 'jira.create_sub_tasks']:
217+
temp_config_dict.update({
218+
item: self.get_boolean(environ[list_item.replace('.', '_').upper()])
219+
})
220+
else:
221+
temp_config_dict.update({
222+
item: environ[list_item.replace('.', '_').upper()]
223+
})
224+
config.update({list_item.split('.')[0]: temp_config_dict})
225+
break
202226
self.logger.debug('Config from environment variables - ' + str(config))
203227
return config
204228

0 commit comments

Comments
 (0)