File size: 21,875 Bytes
ca1d775
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
import gradio as gr
from github import Github, GithubException
import os
import requests

# Za艂aduj token z pliku .env lub ustaw bezpo艣rednio
GITHUB_TOKEN = os.getenv('GITHUB_TOKEN')
g = Github(GITHUB_TOKEN)


def import_repository(owner: str, repo_name: str, vcs_url: str):
    """Importuje repozytorium z podanego URL."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)  # Sprawd藕, czy repozytorium ju偶 istnieje
        return "Repozytorium o tej nazwie ju偶 istnieje."
    except GithubException:
        pass  # Repozytorium nie istnieje, mo偶na importowa膰

    headers = {
        'Authorization': f'token {GITHUB_TOKEN}',
        'Accept': 'application/vnd.github.v3+json',
    }
    import_url = f'https://api.github.com/repos/{owner}/{repo_name}/import'

    payload = {
        'vcs_url': vcs_url,
        'vcs': 'git',
    }

    try:
        response = requests.put(import_url, json=payload, headers=headers)
        if response.status_code == 201:
            return "Import repozytorium zosta艂 rozpocz臋ty."
        else:
            return f"Nie uda艂o si臋 rozpocz膮膰 importu repozytorium. Status: {response.status_code}, Szczeg贸艂y: {response.json()}"
    except Exception as e:
        return f"Wyst膮pi艂 b艂膮d podczas pr贸by importu repozytorium: {str(e)}"


def create_repository(name: str):
    """Tworzy nowe repozytorium."""
    try:
        user = g.get_user()
        repo = user.create_repo(name=name)
        return f"Repozytorium {name} zosta艂o utworzone: {repo.html_url}"
    except GithubException as e:
        return f"Nie uda艂o si臋 utworzy膰 repozytorium: {str(e)}"


def create_file(repo_name: str, branch: str, message: str, content: str, path: str):
    """Tworzy plik w repozytorium."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)
        repo.create_file(path, message, content, branch=branch)
        return f"Plik {path} zosta艂 utworzony w {repo_name} na ga艂臋zi {branch}"
    except GithubException as e:
        return f"Nie uda艂o si臋 utworzy膰 pliku: {str(e)}"


def get_file(repo_name: str, path: str):
    """Pobiera zawarto艣膰 pliku z repozytorium."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)
        file_content = repo.get_contents(path)
        return file_content.decoded_content.decode()
    except GithubException as e:
        return f"Nie znaleziono pliku: {str(e)}"


def delete_file(repo_name: str, branch: str, path: str):
    """Usuwa plik z repozytorium."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)
        file_contents = repo.get_contents(path, ref=branch)
        repo.delete_file(path, "Usu艅 plik", file_contents.sha, branch=branch)
        return f"Plik {path} zosta艂 usuni臋ty z {repo_name} na ga艂臋zi {branch}"
    except GithubException as e:
        return f"Nie uda艂o si臋 usun膮膰 pliku: {str(e)}"


def update_file(repo_name: str, branch: str, path: str, message: str, content: str):
    """Aktualizuje plik w repozytorium."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)
        file_contents = repo.get_contents(path, ref=branch)
        repo.update_file(path, message, content, file_contents.sha, branch=branch)
        return f"Plik {path} zosta艂 zaktualizowany w {repo_name} na ga艂臋zi {branch}"
    except GithubException as e:
        return f"Nie uda艂o si臋 zaktualizowa膰 pliku: {str(e)}"


def list_branches(repo_name: str):
    """Listuje ga艂臋zie w repozytorium."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)
        branches = repo.get_branches()
        return [branch.name for branch in branches]
    except GithubException as e:
        return f"Nie uda艂o si臋 pobra膰 listy ga艂臋zi: {str(e)}"


def create_branch(repo_name: str, source_branch: str, new_branch: str):
    """Tworzy now膮 ga艂膮藕 w repozytorium."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)
        source_branch = repo.get_branch(source_branch)
        repo.create_git_ref(ref=f"refs/heads/{new_branch}", sha=source_branch.commit.sha)
        return f"Ga艂膮藕 {new_branch} zosta艂a utworzona od {source_branch}"
    except GithubException as e:
        return f"Nie uda艂o si臋 utworzy膰 ga艂臋zi: {str(e)}"


def delete_branch(repo_name: str, branch_name: str):
    """Usuwa ga艂膮藕 z repozytorium."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)
        repo.get_git_ref(f"heads/{branch_name}").delete()
        return f"Ga艂膮藕 {branch_name} zosta艂a usuni臋ta"
    except GithubException as e:
        return f"Nie znaleziono ga艂臋zi lub b艂膮d podczas usuwania: {str(e)}"


def create_pull_request(repo_name: str, title: str, body: str, base: str, head: str):
    """Tworzy pull request."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)
        pr = repo.create_pull(title=title, body=body, base=base, head=head)
        return f"Pull request utworzony: {pr.html_url}"
    except GithubException as e:
        return f"Nie uda艂o si臋 utworzy膰 pull requesta: {str(e)}"


def list_open_pull_requests(repo_name: str):
    """Listuje otwarte pull requesty."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)
        open_prs = repo.get_pulls(state='open')
        return [{'title': pr.title, 'url': pr.html_url} for pr in open_prs]
    except GithubException as e:
        return f"Nie uda艂o si臋 pobra膰 listy otwartych pull request贸w: {str(e)}"


def create_issue(repo_name: str, title: str, body: str):
    """Tworzy issue."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)
        issue = repo.create_issue(title=title, body=body)
        return f"Issue utworzone: {issue.html_url}"
    except GithubException as e:
        return f"Nie uda艂o si臋 utworzy膰 issue: {str(e)}"


def list_issues(repo_name: str):
    """Listuje issue."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)
        issues = repo.get_issues(state='open')
        return [{'title': issue.title, 'url': issue.html_url} for issue in issues]
    except GithubException as e:
        return f"Nie uda艂o si臋 pobra膰 listy issue: {str(e)}"


def add_label_to_issue(repo_name: str, issue_number: int, labels: list[str]):
    """Dodaje etykiety do issue."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)
        issue = repo.get_issue(number=int(issue_number))
        for label in labels:
            issue.add_to_labels(label)
        return f"Dodano etykiety do issue #{issue_number}"
    except GithubException as e:
        return f"Nie uda艂o si臋 doda膰 etykiet do issue: {str(e)}"


def close_issue(repo_name: str, issue_number: int):
    """Zamyka issue."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)
        issue = repo.get_issue(number=int(issue_number))
        issue.edit(state='closed')
        return f"Issue #{issue_number} zosta艂o zamkni臋te"
    except GithubException as e:
        return f"Nie uda艂o si臋 zamkn膮膰 issue: {str(e)}"


def add_comment_to_issue(repo_name: str, issue_number: int, comment: str):
    """Dodaje komentarz do issue."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)
        issue = repo.get_issue(number=int(issue_number))
        issue.create_comment(body=comment)
        return f"Dodano komentarz do issue #{issue_number}"
    except GithubException as e:
        return f"Nie uda艂o si臋 doda膰 komentarza do issue: {str(e)}"


def create_release(repo_name: str, tag: str, name: str, message: str):
    """Tworzy release."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)
        release = repo.create_git_release(tag=tag, name=name, message=message)
        return f"Release utworzone: {release.html_url}"
    except GithubException as e:
        return f"Nie uda艂o si臋 utworzy膰 release: {str(e)}"


def list_releases(repo_name: str):
    """Listuje release."""
    try:
        user = g.get_user()
        repo = user.get_repo(repo_name)
        releases = repo.get_releases()
        return [{'tag_name': release.tag_name, 'url': release.html_url} for release in releases]
    except GithubException as e:
        return f"Nie uda艂o si臋 pobra膰 listy release: {str(e)}"


def fork_repository(repo_name: str):
    """Forkuje repozytorium."""
    try:
        user = g.get_user()
        repo = g.get_repo(repo_name)  # Pobierz repozytorium do forkowania
        fork = user.create_fork(repo)
        return f"Fork repozytorium utworzony: {fork.html_url}"
    except GithubException as e:
        return f"Nie uda艂o si臋 utworzy膰 forka repozytorium: {str(e)}"


def list_forks(repo_name: str):
    """Listuje forki repozytorium."""
    try:
        repo = g.get_repo(repo_name)  # Pobierz repozytorium, kt贸rego forki chcesz wy艣wietli膰
        forks = repo.get_forks()
        return [{'full_name': fork.full_name, 'url': fork.html_url} for fork in forks]
    except GithubException as e:
        return f"Nie uda艂o si臋 pobra膰 listy fork贸w: {str(e)}"


def list_files(owner: str, repo_name: str, path: str = ""):
    """Listuje pliki w repozytorium."""
    try:
        repo = g.get_repo(f"{owner}/{repo_name}")
        contents = repo.get_contents(path)
        files = [{'name': content.name, 'path': content.path,
                  'download_url': content.download_url} for content in contents]
        return files
    except GithubException as e:
        return f"Nie uda艂o si臋 pobra膰 listy plik贸w: {str(e)}"


with gr.Blocks() as demo:
    with gr.Tab("Repozytoria"):
        with gr.Row():
            import_repo_owner = gr.Textbox(label="W艂a艣ciciel")
            import_repo_name = gr.Textbox(label="Nazwa repozytorium")
            import_repo_vcs_url = gr.Textbox(label="URL VCS")
            import_repo_button = gr.Button("Importuj repozytorium")
        import_repo_output = gr.Textbox(label="Wynik")
        import_repo_button.click(
            import_repository,
            inputs=[import_repo_owner, import_repo_name,
                    import_repo_vcs_url],
            outputs=import_repo_output,
            api_name="import_repository"
        )

        with gr.Row():
            create_repo_name = gr.Textbox(label="Nazwa repozytorium")
            create_repo_button = gr.Button("Utw贸rz repozytorium")
        create_repo_output = gr.Textbox(label="Wynik")
        create_repo_button.click(
            create_repository,
            inputs=create_repo_name,
            outputs=create_repo_output,
            api_name="create_repository"
        )

    with gr.Tab("Pliki"):
        with gr.Row():
            create_file_repo_name = gr.Textbox(label="Nazwa repozytorium")
            create_file_branch = gr.Textbox(label="Ga艂膮藕")
            create_file_message = gr.Textbox(label="Wiadomo艣膰 commita")
            create_file_content = gr.Textbox(label="Zawarto艣膰 pliku")
            create_file_path = gr.Textbox(label="艢cie偶ka do pliku")
            create_file_button = gr.Button("Utw贸rz plik")
        create_file_output = gr.Textbox(label="Wynik")
        create_file_button.click(
            create_file,
            inputs=[create_file_repo_name, create_file_branch,
                    create_file_message, create_file_content, create_file_path],
            outputs=create_file_output,
            api_name="create_file"
        )

        with gr.Row():
            get_file_repo_name = gr.Textbox(label="Nazwa repozytorium")
            get_file_path = gr.Textbox(label="艢cie偶ka do pliku")
            get_file_button = gr.Button("Pobierz plik")
        get_file_output = gr.Textbox(label="Zawarto艣膰 pliku")
        get_file_button.click(
            get_file,
            inputs=[get_file_repo_name, get_file_path],
            outputs=get_file_output,
            api_name="get_file"
        )

        with gr.Row():
            delete_file_repo_name = gr.Textbox(label="Nazwa repozytorium")
            delete_file_branch = gr.Textbox(label="Ga艂膮藕")
            delete_file_path = gr.Textbox(label="艢cie偶ka do pliku")
            delete_file_button = gr.Button("Usu艅 plik")
        delete_file_output = gr.Textbox(label="Wynik")
        delete_file_button.click(
            delete_file,
            inputs=[delete_file_repo_name, delete_file_branch,
                    delete_file_path],
            outputs=delete_file_output,
            api_name="delete_file"
        )

        with gr.Row():
            update_file_repo_name = gr.Textbox(label="Nazwa repozytorium")
            update_file_branch = gr.Textbox(label="Ga艂膮藕")
            update_file_path = gr.Textbox(label="艢cie偶ka do pliku")
            update_file_message = gr.Textbox(label="Wiadomo艣膰 commita")
            update_file_content = gr.Textbox(label="Nowa zawarto艣膰 pliku")
            update_file_button = gr.Button("Zaktualizuj plik")
        update_file_output = gr.Textbox(label="Wynik")
        update_file_button.click(
            update_file,
            inputs=[update_file_repo_name, update_file_branch,
                    update_file_path, update_file_message, update_file_content],
            outputs=update_file_output,
            api_name="update_file"
        )

    with gr.Tab("Ga艂臋zie"):
        with gr.Row():
            list_branches_repo_name = gr.Textbox(label="Nazwa repozytorium")
            list_branches_button = gr.Button("Listuj ga艂臋zie")
        list_branches_output = gr.Textbox(label="Lista ga艂臋zi")
        list_branches_button.click(
            list_branches,
            inputs=list_branches_repo_name,
            outputs=list_branches_output,
            api_name="list_branches"
        )

        with gr.Row():
            create_branch_repo_name = gr.Textbox(label="Nazwa repozytorium")
            create_branch_source_branch = gr.Textbox(
                label="Nazwa ga艂臋zi 藕r贸d艂owej")
            create_branch_new_branch = gr.Textbox(label="Nazwa nowej ga艂臋zi")
            create_branch_button = gr.Button("Utw贸rz ga艂膮藕")
        create_branch_output = gr.Textbox(label="Wynik")
        create_branch_button.click(
            create_branch,
            inputs=[create_branch_repo_name, create_branch_source_branch,
                    create_branch_new_branch],
            outputs=create_branch_output,
            api_name="create_branch"
        )

        with gr.Row():
            delete_branch_repo_name = gr.Textbox(label="Nazwa repozytorium")
            delete_branch_branch_name = gr.Textbox(label="Nazwa ga艂臋zi")
            delete_branch_button = gr.Button("Usu艅 ga艂膮藕")
        delete_branch_output = gr.Textbox(label="Wynik")
        delete_branch_button.click(
            delete_branch,
            inputs=[delete_branch_repo_name, delete_branch_branch_name],
            outputs=delete_branch_output,
            api_name="delete_branch"
        )

    with gr.Tab("Pull Requesty"):
        with gr.Row():
            create_pr_repo_name = gr.Textbox(label="Nazwa repozytorium")
            create_pr_title = gr.Textbox(label="Tytu艂")
            create_pr_body = gr.Textbox(label="Tre艣膰")
            create_pr_base = gr.Textbox(label="Ga艂膮藕 bazowa")
            create_pr_head = gr.Textbox(label="Ga艂膮藕 docelowa")
            create_pr_button = gr.Button("Utw贸rz Pull Request")
        create_pr_output = gr.Textbox(label="Wynik")
        create_pr_button.click(
            create_pull_request,
            inputs=[create_pr_repo_name, create_pr_title,
                    create_pr_body, create_pr_base, create_pr_head],
            outputs=create_pr_output,
            api_name="create_pull_request"
        )

        with gr.Row():
            list_open_prs_repo_name = gr.Textbox(label="Nazwa repozytorium")
            list_open_prs_button = gr.Button("Listuj otwarte Pull Requesty")
        list_open_prs_output = gr.JSON(label="Lista otwartych Pull Request贸w")
        list_open_prs_button.click(
            list_open_pull_requests,
            inputs=list_open_prs_repo_name,
            outputs=list_open_prs_output,
            api_name="list_open_pull_requests"
        )

    with gr.Tab("Issue"):
        with gr.Row():
            create_issue_repo_name = gr.Textbox(label="Nazwa repozytorium")
            create_issue_title = gr.Textbox(label="Tytu艂")
            create_issue_body = gr.Textbox(label="Tre艣膰")
            create_issue_button = gr.Button("Utw贸rz Issue")
        create_issue_output = gr.Textbox(label="Wynik")
        create_issue_button.click(
            create_issue,
            inputs=[create_issue_repo_name, create_issue_title,
                    create_issue_body],
            outputs=create_issue_output,
            api_name="create_issue"
        )

        with gr.Row():
            list_issues_repo_name = gr.Textbox(label="Nazwa repozytorium")
            list_issues_button = gr.Button("Listuj Issue")
        list_issues_output = gr.JSON(label="Lista Issue")
        list_issues_button.click(
            list_issues,
            inputs=list_issues_repo_name,
            outputs=list_issues_output,
            api_name="list_issues"
        )

        with gr.Row():
            add_label_repo_name = gr.Textbox(label="Nazwa repozytorium")
            add_label_issue_number = gr.Number(
                label="Numer Issue", precision=0)
            add_label_labels = gr.Textbox(
                label="Etykiety (oddzielone przecinkami)")
            add_label_button = gr.Button("Dodaj etykiety")
        add_label_output = gr.Textbox(label="Wynik")
        add_label_button.click(
            lambda repo_name, issue_number, labels: add_label_to_issue(
                repo_name, issue_number, labels.split(",")),
            inputs=[add_label_repo_name, add_label_issue_number,
                    add_label_labels],
            outputs=add_label_output,
            api_name="add_label_to_issue"
        )

        with gr.Row():
            close_issue_repo_name = gr.Textbox(label="Nazwa repozytorium")
            close_issue_issue_number = gr.Number(
                label="Numer Issue", precision=0)
            close_issue_button = gr.Button("Zamknij Issue")
        close_issue_output = gr.Textbox(label="Wynik")
        close_issue_button.click(
            close_issue,
            inputs=[close_issue_repo_name, close_issue_issue_number],
            outputs=close_issue_output,
            api_name="close_issue"
        )

        with gr.Row():
            add_comment_repo_name = gr.Textbox(label="Nazwa repozytorium")
            add_comment_issue_number = gr.Number(
                label="Numer Issue", precision=0)
            add_comment_comment = gr.Textbox(label="Komentarz")
            add_comment_button = gr.Button("Dodaj komentarz")
        add_comment_output = gr.Textbox(label="Wynik")
        add_comment_button.click(
            add_comment_to_issue,
            inputs=[add_comment_repo_name, add_comment_issue_number,
                    add_comment_comment],
            outputs=add_comment_output,
            api_name="add_comment_to_issue"
        )

    with gr.Tab("Release"):
        with gr.Row():
            create_release_repo_name = gr.Textbox(label="Nazwa repozytorium")
            create_release_tag = gr.Textbox(label="Tag")
            create_release_name = gr.Textbox(label="Nazwa")
            create_release_message = gr.Textbox(label="Wiadomo艣膰")
            create_release_button = gr.Button("Utw贸rz Release")
        create_release_output = gr.Textbox(label="Wynik")
        create_release_button.click(
            create_release,
            inputs=[create_release_repo_name, create_release_tag,
                    create_release_name, create_release_message],
            outputs=create_release_output,
            api_name="create_release"
        )

        with gr.Row():
            list_releases_repo_name = gr.Textbox(label="Nazwa repozytorium")
            list_releases_button = gr.Button("Listuj Release")
        list_releases_output = gr.JSON(label="Lista Release")
        list_releases_button.click(
            list_releases,
            inputs=list_releases_repo_name,
            outputs=list_releases_output,
            api_name="list_releases"
        )

    with gr.Tab("Forki"):
        with gr.Row():
            fork_repo_name = gr.Textbox(label="Nazwa repozytorium")
            fork_repo_button = gr.Button("Forkuj repozytorium")
        fork_repo_output = gr.Textbox(label="Wynik")
        fork_repo_button.click(
            fork_repository,
            inputs=fork_repo_name,
            outputs=fork_repo_output,
            api_name="fork_repository"
        )

        with gr.Row():
            list_forks_repo_name = gr.Textbox(label="Nazwa repozytorium")
            list_forks_button = gr.Button("Listuj forki")
        list_forks_output = gr.JSON(label="Lista fork贸w")
        list_forks_button.click(
            list_forks,
            inputs=list_forks_repo_name,
            outputs=list_forks_output,
            api_name="list_forks"
        )

    with gr.Tab("Listowanie plik贸w"):
        with gr.Row():
            list_files_owner = gr.Textbox(label="W艂a艣ciciel")
            list_files_repo_name = gr.Textbox(label="Nazwa repozytorium")
            list_files_path = gr.Textbox(
                label="艢cie偶ka (opcjonalnie)", value="")
            list_files_button = gr.Button("Listuj pliki")
        list_files_output = gr.JSON(label="Lista plik贸w")
        list_files_button.click(
            list_files,
            inputs=[list_files_owner, list_files_repo_name, list_files_path],
            outputs=list_files_output,
            api_name="list_files"
        )

demo.launch()