28 lines
813 B
Python
28 lines
813 B
Python
import os
|
|
|
|
def run():
|
|
try:
|
|
input_iterations = int(os.environ['INPUT_ITERATIONS'])
|
|
except ValueError:
|
|
print(f"Invalid number: {os.environ['INPUT_ITERATIONS']}")
|
|
return 1
|
|
|
|
current_number = 1
|
|
last_number = 1
|
|
|
|
for _ in range(input_iterations):
|
|
print(current_number)
|
|
temp = current_number
|
|
current_number = current_number + last_number
|
|
last_number = temp
|
|
|
|
output_file_path = os.environ['GITHUB_OUTPUT']
|
|
os.makedirs(os.path.dirname(output_file_path), exist_ok=True) # Create directory if it does not exist
|
|
|
|
with open(output_file_path, 'a') as gh_output: # 'a' mode will create the file if it does not exist, otherwise it will append
|
|
print(f'lastNumber={last_number}', file=gh_output)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
run()
|