summary refs log tree commit diff stats
path: root/github/output.py
blob: 6d64d71d13fdc2d913ee1576cd57a9e17810bcf1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from os import path, makedirs

def write_file(file_path : str, string : str) -> None:
    makedirs(path.dirname(file_path), exist_ok = True)
    with open(file_path, "w") as file:
        file.write(string)

def output_issue(issue : dict) -> None:
    try:
        if 'documentation' in issue['labels']:
            write_file(f"issues/documentation/{issue['id']}", issue['title'] + '\n' + (issue['description'] or ""))
        else:
            write_file(f"issues/{issue['id']}", issue['title'] + '\n' + (issue['description'] or ""))
    except TypeError:
        print(f"error with bug {issue['id']}")
        exit()