diff --git a/action/_v2_config_template.py b/action/_v2_config_template.py index 361c2a0..ff8c5c1 100644 --- a/action/_v2_config_template.py +++ b/action/_v2_config_template.py @@ -73,6 +73,11 @@ def _convert_2_string(item): return str(item) +class IDumper(yaml.SafeDumper): + def increase_indent(self, flow=False, indentless=False): + return super(IDumper, self).increase_indent(flow, False) + + class MultiKeyDict(dict): """Dictionary class which supports duplicate keys. This class allows for an item to be added into a standard python dictionary @@ -374,8 +379,9 @@ class ActionModule(ActionBase): new_items=config_overrides, list_extend=list_extend ) - return yaml.safe_dump( + return yaml.dump( merged_resultant, + Dumper=IDumper, default_flow_style=False, width=1000, ) diff --git a/tests/files/test_extend.yml.expected b/tests/files/test_extend.yml.expected index b81b2e3..c132a76 100644 --- a/tests/files/test_extend.yml.expected +++ b/tests/files/test_extend.yml.expected @@ -1,8 +1,8 @@ list_one: -- one -- two -- three -- four + - one + - two + - three + - four list_two: -- one -- two + - one + - two diff --git a/tests/files/test_no_extend.yml.expected b/tests/files/test_no_extend.yml.expected index b864299..4713768 100644 --- a/tests/files/test_no_extend.yml.expected +++ b/tests/files/test_no_extend.yml.expected @@ -1,5 +1,5 @@ list_one: -- four + - four list_two: -- one -- two + - one + - two