Skip to content

Commit

Permalink
Create generator.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed Mar 30, 2021
1 parent 8a28885 commit a587ed6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import os
import yaml


Loader = getattr(yaml, 'CSafeLoader', yaml.SafeLoader)

ACTION_YML_FILE = os.env['INPUT_ACTION_FILE']
INPUT_README_FILE = os.env['INPUT_README']


def main() -> int:
with open(ACTION_YML_FILE) as f:
inputs = yaml.load(f, Loader=Loader)

with open(INPUT_README_FILE) as f:
contents = f.read()

before, delim, _ = contents.partition('[generated-inputs]: # (generated)\n')

## TODO: Return a table of input and output
rest = ""

with open(INPUT_README_FILE, 'w') as f:
f.write(before + delim + rest + '\n')

return 0


if __name__ == '__main__':
exit(main())

0 comments on commit a587ed6

Please sign in to comment.