Skip to content

Commit eac0f87

Browse files
committed
Clean up config
1 parent c40d7e0 commit eac0f87

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

llm-complete-guide/gh_action_rag.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def main(
9696
name_id_or_prefix=UUID(action_id),
9797
configuration={
9898
"template_id": str(rt.id),
99-
"run_config": config
99+
"run_config": pop_restricted_configs(config)
100100
}
101101
)
102102

@@ -107,5 +107,31 @@ def main(
107107
)()
108108

109109

110+
def pop_restricted_configs(run_configuration: dict) -> dict:
111+
"""Removes restricted configuration items from a run configuration dictionary.
112+
113+
Args:
114+
run_configuration: Dictionary containing run configuration settings
115+
116+
Returns:
117+
Modified dictionary with restricted items removed
118+
"""
119+
# Pop top-level restricted items
120+
run_configuration.pop('parameters', None)
121+
run_configuration.pop('build', None)
122+
run_configuration.pop('schedule', None)
123+
124+
# Pop docker settings if they exist
125+
if 'settings' in run_configuration:
126+
run_configuration['settings'].pop('docker', None)
127+
128+
# Pop docker settings from steps if they exist
129+
if 'steps' in run_configuration:
130+
for step in run_configuration['steps'].values():
131+
if 'settings' in step:
132+
step['settings'].pop('docker', None)
133+
134+
return run_configuration
135+
110136
if __name__ == "__main__":
111137
main()

0 commit comments

Comments
 (0)