File size: 1,131 Bytes
3bbc731
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import gradio as gr
from graphql_calls import get_tag_commit_date, get_commits


def get_all_commits(token, repo, tag, branch):
    date = get_tag_commit_date(token, repo, tag)
    commits = get_commits(token, repo, date)

    result = ''

    for commit in commits:
        if '(#' in commit.message:
            split = commit.message.split('(#')
            message = split[0]
            number = split[1].strip(')')

            result += f"* {message} by @{commit.user} in #{number}\n"
        else:
            result += f"* {commit.message} by @{commit.user} (direct commit on {branch})\n"

    return result


demo = gr.Interface(
    fn=get_all_commits,
    inputs=[
        gr.inputs.Textbox(lines=1, placeholder="Your GitHub token"),
        gr.inputs.Textbox(lines=1, placeholder="Repository", default='huggingface/transformers'),
        gr.inputs.Textbox(lines=1, placeholder="The tag from which to get commit"),
        gr.inputs.Textbox(lines=1, placeholder="The linear branch on which the new version tag will be added", default='main'),
    ],
    outputs='text',
)


if __name__ == "__main__":
    demo.launch()