File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818logging .basicConfig (level = logging .INFO )
1919
2020
21- def get_github_output (output_name : str ) -> str :
21+ def get_github_output () -> str :
2222 '''
2323 Reads the GITHUB_OUTPUT environment file and returns the value of the specified output.
2424 '''
25- result = None
26-
27- found_keys = []
2825
2926 with open (os .environ ['GITHUB_OUTPUT' ], 'r' ) as f :
3027 txt = f .read ()
@@ -35,21 +32,16 @@ def get_github_output(output_name:str) -> str:
3532
3633 logging .warning (f'# lines of GITHUB_OUTPUT: { len (txt_lines )} ' )
3734
38- for line in txt .splitlines ():
39- key , value = line .strip ().split ('=' )
40- found_keys .append (key )
41- if key == output_name :
42- result = value
43-
44- if result is None :
45- logging .warning (
46- f'Output { output_name } not found in GITHUB_OUTPUT file\n '
47- f'Keys found: { found_keys } '
48- )
35+ if len (txt_lines ) < 100 :
36+ logging .info (txt )
4937
50- return result # Or raise an exception if the output is not found
38+ return len ( txt )
5139
5240
5341def test_feedback () -> None :
54- feedback_str = get_github_output ('feedback' )
42+ feedback_str = get_github_output ()
5543 assert feedback_str , 'No feedback found'
44+
45+
46+ if "__main__" == __name__ :
47+ pytest .main ([__file__ ])
You can’t perform that action at this time.
0 commit comments