Update app.py
Browse files
app.py
CHANGED
@@ -8,549 +8,289 @@ GITHUB_TOKEN = os.getenv('GITHUB_TOKEN')
|
|
8 |
g = Github(GITHUB_TOKEN)
|
9 |
|
10 |
|
11 |
-
def
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
try:
|
32 |
-
response = requests.put(import_url, json=payload, headers=headers)
|
33 |
-
if response.status_code == 201:
|
34 |
-
return "Import repozytorium został rozpoczęty."
|
35 |
-
else:
|
36 |
-
return f"Nie udało się rozpocząć importu repozytorium. Status: {response.status_code}, Szczegóły: {response.json()}"
|
37 |
-
except Exception as e:
|
38 |
-
return f"Wystąpił błąd podczas próby importu repozytorium: {str(e)}"
|
39 |
-
|
40 |
-
|
41 |
-
def create_repository(name: str):
|
42 |
-
"""Tworzy nowe repozytorium."""
|
43 |
-
try:
|
44 |
-
user = g.get_user()
|
45 |
-
repo = user.create_repo(name=name)
|
46 |
-
return f"Repozytorium {name} zostało utworzone: {repo.html_url}"
|
47 |
-
except GithubException as e:
|
48 |
-
return f"Nie udało się utworzyć repozytorium: {str(e)}"
|
49 |
-
|
50 |
-
|
51 |
-
def create_file(repo_name: str, branch: str, message: str, content: str, path: str):
|
52 |
-
"""Tworzy plik w repozytorium."""
|
53 |
-
try:
|
54 |
-
user = g.get_user()
|
55 |
-
repo = user.get_repo(repo_name)
|
56 |
-
repo.create_file(path, message, content, branch=branch)
|
57 |
-
return f"Plik {path} został utworzony w {repo_name} na gałęzi {branch}"
|
58 |
-
except GithubException as e:
|
59 |
-
return f"Nie udało się utworzyć pliku: {str(e)}"
|
60 |
-
|
61 |
-
|
62 |
-
def get_file(repo_name: str, path: str):
|
63 |
-
"""Pobiera zawartość pliku z repozytorium."""
|
64 |
-
try:
|
65 |
-
user = g.get_user()
|
66 |
-
repo = user.get_repo(repo_name)
|
67 |
-
file_content = repo.get_contents(path)
|
68 |
-
return file_content.decoded_content.decode()
|
69 |
-
except GithubException as e:
|
70 |
-
return f"Nie znaleziono pliku: {str(e)}"
|
71 |
-
|
72 |
-
|
73 |
-
def delete_file(repo_name: str, branch: str, path: str):
|
74 |
-
"""Usuwa plik z repozytorium."""
|
75 |
-
try:
|
76 |
-
user = g.get_user()
|
77 |
-
repo = user.get_repo(repo_name)
|
78 |
-
file_contents = repo.get_contents(path, ref=branch)
|
79 |
-
repo.delete_file(path, "Usuń plik", file_contents.sha, branch=branch)
|
80 |
-
return f"Plik {path} został usunięty z {repo_name} na gałęzi {branch}"
|
81 |
-
except GithubException as e:
|
82 |
-
return f"Nie udało się usunąć pliku: {str(e)}"
|
83 |
-
|
84 |
-
|
85 |
-
def update_file(repo_name: str, branch: str, path: str, message: str, content: str):
|
86 |
-
"""Aktualizuje plik w repozytorium."""
|
87 |
-
try:
|
88 |
-
user = g.get_user()
|
89 |
-
repo = user.get_repo(repo_name)
|
90 |
-
file_contents = repo.get_contents(path, ref=branch)
|
91 |
-
repo.update_file(path, message, content, file_contents.sha, branch=branch)
|
92 |
-
return f"Plik {path} został zaktualizowany w {repo_name} na gałęzi {branch}"
|
93 |
-
except GithubException as e:
|
94 |
-
return f"Nie udało się zaktualizować pliku: {str(e)}"
|
95 |
-
|
96 |
-
|
97 |
-
def list_branches(repo_name: str):
|
98 |
-
"""Listuje gałęzie w repozytorium."""
|
99 |
-
try:
|
100 |
-
user = g.get_user()
|
101 |
-
repo = user.get_repo(repo_name)
|
102 |
-
branches = repo.get_branches()
|
103 |
-
return [branch.name for branch in branches]
|
104 |
-
except GithubException as e:
|
105 |
-
return f"Nie udało się pobrać listy gałęzi: {str(e)}"
|
106 |
-
|
107 |
-
|
108 |
-
def create_branch(repo_name: str, source_branch: str, new_branch: str):
|
109 |
-
"""Tworzy nową gałąź w repozytorium."""
|
110 |
-
try:
|
111 |
-
user = g.get_user()
|
112 |
-
repo = user.get_repo(repo_name)
|
113 |
-
source_branch = repo.get_branch(source_branch)
|
114 |
-
repo.create_git_ref(ref=f"refs/heads/{new_branch}", sha=source_branch.commit.sha)
|
115 |
-
return f"Gałąź {new_branch} została utworzona od {source_branch}"
|
116 |
-
except GithubException as e:
|
117 |
-
return f"Nie udało się utworzyć gałęzi: {str(e)}"
|
118 |
-
|
119 |
-
|
120 |
-
def delete_branch(repo_name: str, branch_name: str):
|
121 |
-
"""Usuwa gałąź z repozytorium."""
|
122 |
-
try:
|
123 |
-
user = g.get_user()
|
124 |
-
repo = user.get_repo(repo_name)
|
125 |
-
repo.get_git_ref(f"heads/{branch_name}").delete()
|
126 |
-
return f"Gałąź {branch_name} została usunięta"
|
127 |
-
except GithubException as e:
|
128 |
-
return f"Nie znaleziono gałęzi lub błąd podczas usuwania: {str(e)}"
|
129 |
-
|
130 |
-
|
131 |
-
def create_pull_request(repo_name: str, title: str, body: str, base: str, head: str):
|
132 |
-
"""Tworzy pull request."""
|
133 |
-
try:
|
134 |
-
user = g.get_user()
|
135 |
-
repo = user.get_repo(repo_name)
|
136 |
-
pr = repo.create_pull(title=title, body=body, base=base, head=head)
|
137 |
-
return f"Pull request utworzony: {pr.html_url}"
|
138 |
-
except GithubException as e:
|
139 |
-
return f"Nie udało się utworzyć pull requesta: {str(e)}"
|
140 |
-
|
141 |
-
|
142 |
-
def list_open_pull_requests(repo_name: str):
|
143 |
-
"""Listuje otwarte pull requesty."""
|
144 |
-
try:
|
145 |
-
user = g.get_user()
|
146 |
-
repo = user.get_repo(repo_name)
|
147 |
-
open_prs = repo.get_pulls(state='open')
|
148 |
-
return [{'title': pr.title, 'url': pr.html_url} for pr in open_prs]
|
149 |
-
except GithubException as e:
|
150 |
-
return f"Nie udało się pobrać listy otwartych pull requestów: {str(e)}"
|
151 |
-
|
152 |
-
|
153 |
-
def create_issue(repo_name: str, title: str, body: str):
|
154 |
-
"""Tworzy issue."""
|
155 |
-
try:
|
156 |
-
user = g.get_user()
|
157 |
-
repo = user.get_repo(repo_name)
|
158 |
-
issue = repo.create_issue(title=title, body=body)
|
159 |
-
return f"Issue utworzone: {issue.html_url}"
|
160 |
-
except GithubException as e:
|
161 |
-
return f"Nie udało się utworzyć issue: {str(e)}"
|
162 |
-
|
163 |
-
|
164 |
-
def list_issues(repo_name: str):
|
165 |
-
"""Listuje issue."""
|
166 |
-
try:
|
167 |
-
user = g.get_user()
|
168 |
-
repo = user.get_repo(repo_name)
|
169 |
-
issues = repo.get_issues(state='open')
|
170 |
-
return [{'title': issue.title, 'url': issue.html_url} for issue in issues]
|
171 |
-
except GithubException as e:
|
172 |
-
return f"Nie udało się pobrać listy issue: {str(e)}"
|
173 |
-
|
174 |
-
|
175 |
-
def add_label_to_issue(repo_name: str, issue_number: int, labels: list[str]):
|
176 |
-
"""Dodaje etykiety do issue."""
|
177 |
-
try:
|
178 |
-
user = g.get_user()
|
179 |
-
repo = user.get_repo(repo_name)
|
180 |
-
issue = repo.get_issue(number=int(issue_number))
|
181 |
-
for label in labels:
|
182 |
-
issue.add_to_labels(label)
|
183 |
-
return f"Dodano etykiety do issue #{issue_number}"
|
184 |
-
except GithubException as e:
|
185 |
-
return f"Nie udało się dodać etykiet do issue: {str(e)}"
|
186 |
-
|
187 |
-
|
188 |
-
def close_issue(repo_name: str, issue_number: int):
|
189 |
-
"""Zamyka issue."""
|
190 |
-
try:
|
191 |
-
user = g.get_user()
|
192 |
-
repo = user.get_repo(repo_name)
|
193 |
-
issue = repo.get_issue(number=int(issue_number))
|
194 |
-
issue.edit(state='closed')
|
195 |
-
return f"Issue #{issue_number} zostało zamknięte"
|
196 |
-
except GithubException as e:
|
197 |
-
return f"Nie udało się zamknąć issue: {str(e)}"
|
198 |
|
199 |
-
|
200 |
-
def add_comment_to_issue(repo_name: str, issue_number: int, comment: str):
|
201 |
-
"""Dodaje komentarz do issue."""
|
202 |
-
try:
|
203 |
-
user = g.get_user()
|
204 |
-
repo = user.get_repo(repo_name)
|
205 |
-
issue = repo.get_issue(number=int(issue_number))
|
206 |
-
issue.create_comment(body=comment)
|
207 |
-
return f"Dodano komentarz do issue #{issue_number}"
|
208 |
-
except GithubException as e:
|
209 |
-
return f"Nie udało się dodać komentarza do issue: {str(e)}"
|
210 |
-
|
211 |
-
|
212 |
-
def create_release(repo_name: str, tag: str, name: str, message: str):
|
213 |
-
"""Tworzy release."""
|
214 |
-
try:
|
215 |
-
user = g.get_user()
|
216 |
-
repo = user.get_repo(repo_name)
|
217 |
-
release = repo.create_git_release(tag=tag, name=name, message=message)
|
218 |
-
return f"Release utworzone: {release.html_url}"
|
219 |
-
except GithubException as e:
|
220 |
-
return f"Nie udało się utworzyć release: {str(e)}"
|
221 |
-
|
222 |
-
|
223 |
-
def list_releases(repo_name: str):
|
224 |
-
"""Listuje release."""
|
225 |
-
try:
|
226 |
-
user = g.get_user()
|
227 |
-
repo = user.get_repo(repo_name)
|
228 |
-
releases = repo.get_releases()
|
229 |
-
return [{'tag_name': release.tag_name, 'url': release.html_url} for release in releases]
|
230 |
-
except GithubException as e:
|
231 |
-
return f"Nie udało się pobrać listy release: {str(e)}"
|
232 |
-
|
233 |
-
|
234 |
-
def fork_repository(repo_name: str):
|
235 |
-
"""Forkuje repozytorium."""
|
236 |
-
try:
|
237 |
-
user = g.get_user()
|
238 |
-
repo = g.get_repo(repo_name) # Pobierz repozytorium do forkowania
|
239 |
-
fork = user.create_fork(repo)
|
240 |
-
return f"Fork repozytorium utworzony: {fork.html_url}"
|
241 |
-
except GithubException as e:
|
242 |
-
return f"Nie udało się utworzyć forka repozytorium: {str(e)}"
|
243 |
-
|
244 |
-
|
245 |
-
def list_forks(repo_name: str):
|
246 |
-
"""Listuje forki repozytorium."""
|
247 |
try:
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
|
|
|
|
|
254 |
|
255 |
-
def list_files(owner: str, repo_name: str, path: str = ""):
|
256 |
-
"""Listuje pliki w repozytorium."""
|
257 |
-
try:
|
258 |
-
repo = g.get_repo(f"{owner}/{repo_name}")
|
259 |
-
contents = repo.get_contents(path)
|
260 |
-
files = [{'name': content.name, 'path': content.path,
|
261 |
-
'download_url': content.download_url} for content in contents]
|
262 |
-
return files
|
263 |
except GithubException as e:
|
264 |
-
return f"
|
|
|
|
|
265 |
|
266 |
|
267 |
with gr.Blocks() as demo:
|
268 |
-
with gr.
|
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 |
-
with gr.Tab("Pliki"):
|
295 |
-
with gr.Row():
|
296 |
-
create_file_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
297 |
-
create_file_branch = gr.Textbox(label="Gałąź")
|
298 |
-
create_file_message = gr.Textbox(label="Wiadomość commita")
|
299 |
-
create_file_content = gr.Textbox(label="Zawartość pliku")
|
300 |
-
create_file_path = gr.Textbox(label="Ścieżka do pliku")
|
301 |
-
create_file_button = gr.Button("Utwórz plik")
|
302 |
-
create_file_output = gr.Textbox(label="Wynik")
|
303 |
-
create_file_button.click(
|
304 |
-
create_file,
|
305 |
-
inputs=[create_file_repo_name, create_file_branch,
|
306 |
-
create_file_message, create_file_content, create_file_path],
|
307 |
-
outputs=create_file_output,
|
308 |
-
api_name="create_file"
|
309 |
-
)
|
310 |
-
|
311 |
-
with gr.Row():
|
312 |
-
get_file_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
313 |
-
get_file_path = gr.Textbox(label="Ścieżka do pliku")
|
314 |
-
get_file_button = gr.Button("Pobierz plik")
|
315 |
-
get_file_output = gr.Textbox(label="Zawartość pliku")
|
316 |
-
get_file_button.click(
|
317 |
-
get_file,
|
318 |
-
inputs=[get_file_repo_name, get_file_path],
|
319 |
-
outputs=get_file_output,
|
320 |
-
api_name="get_file"
|
321 |
-
)
|
322 |
-
|
323 |
-
with gr.Row():
|
324 |
-
delete_file_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
325 |
-
delete_file_branch = gr.Textbox(label="Gałąź")
|
326 |
-
delete_file_path = gr.Textbox(label="Ścieżka do pliku")
|
327 |
-
delete_file_button = gr.Button("Usuń plik")
|
328 |
-
delete_file_output = gr.Textbox(label="Wynik")
|
329 |
-
delete_file_button.click(
|
330 |
-
delete_file,
|
331 |
-
inputs=[delete_file_repo_name, delete_file_branch,
|
332 |
-
delete_file_path],
|
333 |
-
outputs=delete_file_output,
|
334 |
-
api_name="delete_file"
|
335 |
-
)
|
336 |
-
|
337 |
-
with gr.Row():
|
338 |
-
update_file_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
339 |
-
update_file_branch = gr.Textbox(label="Gałąź")
|
340 |
-
update_file_path = gr.Textbox(label="Ścieżka do pliku")
|
341 |
-
update_file_message = gr.Textbox(label="Wiadomość commita")
|
342 |
-
update_file_content = gr.Textbox(label="Nowa zawartość pliku")
|
343 |
-
update_file_button = gr.Button("Zaktualizuj plik")
|
344 |
-
update_file_output = gr.Textbox(label="Wynik")
|
345 |
-
update_file_button.click(
|
346 |
-
update_file,
|
347 |
-
inputs=[update_file_repo_name, update_file_branch,
|
348 |
-
update_file_path, update_file_message, update_file_content],
|
349 |
-
outputs=update_file_output,
|
350 |
-
api_name="update_file"
|
351 |
-
)
|
352 |
-
|
353 |
-
with gr.Tab("Gałęzie"):
|
354 |
-
with gr.Row():
|
355 |
-
list_branches_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
356 |
-
list_branches_button = gr.Button("Listuj gałęzie")
|
357 |
-
list_branches_output = gr.Textbox(label="Lista gałęzi")
|
358 |
-
list_branches_button.click(
|
359 |
-
list_branches,
|
360 |
-
inputs=list_branches_repo_name,
|
361 |
-
outputs=list_branches_output,
|
362 |
-
api_name="list_branches"
|
363 |
-
)
|
364 |
-
|
365 |
-
with gr.Row():
|
366 |
-
create_branch_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
367 |
-
create_branch_source_branch = gr.Textbox(
|
368 |
-
label="Nazwa gałęzi źródłowej")
|
369 |
-
create_branch_new_branch = gr.Textbox(label="Nazwa nowej gałęzi")
|
370 |
-
create_branch_button = gr.Button("Utwórz gałąź")
|
371 |
-
create_branch_output = gr.Textbox(label="Wynik")
|
372 |
-
create_branch_button.click(
|
373 |
-
create_branch,
|
374 |
-
inputs=[create_branch_repo_name, create_branch_source_branch,
|
375 |
-
create_branch_new_branch],
|
376 |
-
outputs=create_branch_output,
|
377 |
-
api_name="create_branch"
|
378 |
-
)
|
379 |
-
|
380 |
-
with gr.Row():
|
381 |
-
delete_branch_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
382 |
-
delete_branch_branch_name = gr.Textbox(label="Nazwa gałęzi")
|
383 |
-
delete_branch_button = gr.Button("Usuń gałąź")
|
384 |
-
delete_branch_output = gr.Textbox(label="Wynik")
|
385 |
-
delete_branch_button.click(
|
386 |
-
delete_branch,
|
387 |
-
inputs=[delete_branch_repo_name, delete_branch_branch_name],
|
388 |
-
outputs=delete_branch_output,
|
389 |
-
api_name="delete_branch"
|
390 |
-
)
|
391 |
-
|
392 |
-
with gr.Tab("Pull Requesty"):
|
393 |
-
with gr.Row():
|
394 |
-
create_pr_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
395 |
-
create_pr_title = gr.Textbox(label="Tytuł")
|
396 |
-
create_pr_body = gr.Textbox(label="Treść")
|
397 |
-
create_pr_base = gr.Textbox(label="Gałąź bazowa")
|
398 |
-
create_pr_head = gr.Textbox(label="Gałąź docelowa")
|
399 |
-
create_pr_button = gr.Button("Utwórz Pull Request")
|
400 |
-
create_pr_output = gr.Textbox(label="Wynik")
|
401 |
-
create_pr_button.click(
|
402 |
-
create_pull_request,
|
403 |
-
inputs=[create_pr_repo_name, create_pr_title,
|
404 |
-
create_pr_body, create_pr_base, create_pr_head],
|
405 |
-
outputs=create_pr_output,
|
406 |
-
api_name="create_pull_request"
|
407 |
-
)
|
408 |
-
|
409 |
-
with gr.Row():
|
410 |
-
list_open_prs_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
411 |
-
list_open_prs_button = gr.Button("Listuj otwarte Pull Requesty")
|
412 |
-
list_open_prs_output = gr.JSON(label="Lista otwartych Pull Requestów")
|
413 |
-
list_open_prs_button.click(
|
414 |
-
list_open_pull_requests,
|
415 |
-
inputs=list_open_prs_repo_name,
|
416 |
-
outputs=list_open_prs_output,
|
417 |
-
api_name="list_open_pull_requests"
|
418 |
-
)
|
419 |
-
|
420 |
-
with gr.Tab("Issue"):
|
421 |
-
with gr.Row():
|
422 |
-
create_issue_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
423 |
-
create_issue_title = gr.Textbox(label="Tytuł")
|
424 |
-
create_issue_body = gr.Textbox(label="Treść")
|
425 |
-
create_issue_button = gr.Button("Utwórz Issue")
|
426 |
-
create_issue_output = gr.Textbox(label="Wynik")
|
427 |
-
create_issue_button.click(
|
428 |
-
create_issue,
|
429 |
-
inputs=[create_issue_repo_name, create_issue_title,
|
430 |
-
create_issue_body],
|
431 |
-
outputs=create_issue_output,
|
432 |
-
api_name="create_issue"
|
433 |
-
)
|
434 |
-
|
435 |
-
with gr.Row():
|
436 |
-
list_issues_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
437 |
-
list_issues_button = gr.Button("Listuj Issue")
|
438 |
-
list_issues_output = gr.JSON(label="Lista Issue")
|
439 |
-
list_issues_button.click(
|
440 |
-
list_issues,
|
441 |
-
inputs=list_issues_repo_name,
|
442 |
-
outputs=list_issues_output,
|
443 |
-
api_name="list_issues"
|
444 |
-
)
|
445 |
-
|
446 |
-
with gr.Row():
|
447 |
-
add_label_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
448 |
-
add_label_issue_number = gr.Number(
|
449 |
-
label="Numer Issue", precision=0)
|
450 |
-
add_label_labels = gr.Textbox(
|
451 |
-
label="Etykiety (oddzielone przecinkami)")
|
452 |
-
add_label_button = gr.Button("Dodaj etykiety")
|
453 |
-
add_label_output = gr.Textbox(label="Wynik")
|
454 |
-
add_label_button.click(
|
455 |
-
lambda repo_name, issue_number, labels: add_label_to_issue(
|
456 |
-
repo_name, issue_number, labels.split(",")),
|
457 |
-
inputs=[add_label_repo_name, add_label_issue_number,
|
458 |
-
add_label_labels],
|
459 |
-
outputs=add_label_output,
|
460 |
-
api_name="add_label_to_issue"
|
461 |
-
)
|
462 |
-
|
463 |
-
with gr.Row():
|
464 |
-
close_issue_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
465 |
-
close_issue_issue_number = gr.Number(
|
466 |
-
label="Numer Issue", precision=0)
|
467 |
-
close_issue_button = gr.Button("Zamknij Issue")
|
468 |
-
close_issue_output = gr.Textbox(label="Wynik")
|
469 |
-
close_issue_button.click(
|
470 |
-
close_issue,
|
471 |
-
inputs=[close_issue_repo_name, close_issue_issue_number],
|
472 |
-
outputs=close_issue_output,
|
473 |
-
api_name="close_issue"
|
474 |
-
)
|
475 |
-
|
476 |
-
with gr.Row():
|
477 |
-
add_comment_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
478 |
-
add_comment_issue_number = gr.Number(
|
479 |
-
label="Numer Issue", precision=0)
|
480 |
-
add_comment_comment = gr.Textbox(label="Komentarz")
|
481 |
-
add_comment_button = gr.Button("Dodaj komentarz")
|
482 |
-
add_comment_output = gr.Textbox(label="Wynik")
|
483 |
-
add_comment_button.click(
|
484 |
-
add_comment_to_issue,
|
485 |
-
inputs=[add_comment_repo_name, add_comment_issue_number,
|
486 |
-
add_comment_comment],
|
487 |
-
outputs=add_comment_output,
|
488 |
-
api_name="add_comment_to_issue"
|
489 |
-
)
|
490 |
-
|
491 |
-
with gr.Tab("Release"):
|
492 |
-
with gr.Row():
|
493 |
-
create_release_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
494 |
-
create_release_tag = gr.Textbox(label="Tag")
|
495 |
-
create_release_name = gr.Textbox(label="Nazwa")
|
496 |
-
create_release_message = gr.Textbox(label="Wiadomość")
|
497 |
-
create_release_button = gr.Button("Utwórz Release")
|
498 |
-
create_release_output = gr.Textbox(label="Wynik")
|
499 |
-
create_release_button.click(
|
500 |
-
create_release,
|
501 |
-
inputs=[create_release_repo_name, create_release_tag,
|
502 |
-
create_release_name, create_release_message],
|
503 |
-
outputs=create_release_output,
|
504 |
-
api_name="create_release"
|
505 |
-
)
|
506 |
-
|
507 |
-
with gr.Row():
|
508 |
-
list_releases_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
509 |
-
list_releases_button = gr.Button("Listuj Release")
|
510 |
-
list_releases_output = gr.JSON(label="Lista Release")
|
511 |
-
list_releases_button.click(
|
512 |
-
list_releases,
|
513 |
-
inputs=list_releases_repo_name,
|
514 |
-
outputs=list_releases_output,
|
515 |
-
api_name="list_releases"
|
516 |
-
)
|
517 |
-
|
518 |
-
with gr.Tab("Forki"):
|
519 |
-
with gr.Row():
|
520 |
-
fork_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
521 |
-
fork_repo_button = gr.Button("Forkuj repozytorium")
|
522 |
-
fork_repo_output = gr.Textbox(label="Wynik")
|
523 |
-
fork_repo_button.click(
|
524 |
-
fork_repository,
|
525 |
-
inputs=fork_repo_name,
|
526 |
-
outputs=fork_repo_output,
|
527 |
-
api_name="fork_repository"
|
528 |
-
)
|
529 |
-
|
530 |
-
with gr.Row():
|
531 |
-
list_forks_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
532 |
-
list_forks_button = gr.Button("Listuj forki")
|
533 |
-
list_forks_output = gr.JSON(label="Lista forków")
|
534 |
-
list_forks_button.click(
|
535 |
-
list_forks,
|
536 |
-
inputs=list_forks_repo_name,
|
537 |
-
outputs=list_forks_output,
|
538 |
-
api_name="list_forks"
|
539 |
-
)
|
540 |
-
|
541 |
-
with gr.Tab("Listowanie plików"):
|
542 |
-
with gr.Row():
|
543 |
-
list_files_owner = gr.Textbox(label="Właściciel")
|
544 |
-
list_files_repo_name = gr.Textbox(label="Nazwa repozytorium")
|
545 |
-
list_files_path = gr.Textbox(
|
546 |
-
label="Ścieżka (opcjonalnie)", value="")
|
547 |
-
list_files_button = gr.Button("Listuj pliki")
|
548 |
-
list_files_output = gr.JSON(label="Lista plików")
|
549 |
-
list_files_button.click(
|
550 |
-
list_files,
|
551 |
-
inputs=[list_files_owner, list_files_repo_name, list_files_path],
|
552 |
-
outputs=list_files_output,
|
553 |
-
api_name="list_files"
|
554 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
555 |
|
556 |
demo.launch()
|
|
|
8 |
g = Github(GITHUB_TOKEN)
|
9 |
|
10 |
|
11 |
+
def github_tool(
|
12 |
+
action: str,
|
13 |
+
repo_name: str = None,
|
14 |
+
branch: str = "main", # domyślna gałąź
|
15 |
+
path: str = None,
|
16 |
+
content: str = None,
|
17 |
+
message: str = None,
|
18 |
+
owner: str = None,
|
19 |
+
vcs_url: str = None,
|
20 |
+
title: str = None,
|
21 |
+
body: str = None,
|
22 |
+
base: str = None,
|
23 |
+
head: str = None,
|
24 |
+
issue_number: int = None,
|
25 |
+
labels: str = None, # etykiety oddzielone przecinkami
|
26 |
+
tag: str = None,
|
27 |
+
name: str = None, # nazwa release
|
28 |
+
):
|
29 |
+
"""Narzędzie do zarządzania repozytoriami GitHub."""
|
30 |
+
user = g.get_user()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
try:
|
33 |
+
if action == "import_repository":
|
34 |
+
if not all([owner, repo_name, vcs_url]):
|
35 |
+
raise ValueError(
|
36 |
+
"Brakujące parametry: owner, repo_name, vcs_url")
|
37 |
+
|
38 |
+
# Sprawdź, czy repozytorium już istnieje
|
39 |
+
try:
|
40 |
+
repo = user.get_repo(repo_name)
|
41 |
+
return "Repozytorium o tej nazwie już istnieje."
|
42 |
+
except GithubException:
|
43 |
+
pass
|
44 |
+
|
45 |
+
headers = {
|
46 |
+
'Authorization': f'token {GITHUB_TOKEN}',
|
47 |
+
'Accept': 'application/vnd.github.v3+json',
|
48 |
+
}
|
49 |
+
import_url = f'https://api.github.com/repos/{owner}/{repo_name}/import'
|
50 |
+
payload = {'vcs_url': vcs_url, 'vcs': 'git'}
|
51 |
+
response = requests.put(import_url, json=payload, headers=headers)
|
52 |
+
if response.status_code == 201:
|
53 |
+
return "Import repozytorium został rozpoczęty."
|
54 |
+
else:
|
55 |
+
return f"Błąd importu: {response.status_code}, {response.json()}"
|
56 |
+
|
57 |
+
elif action == "create_repository":
|
58 |
+
if not repo_name:
|
59 |
+
raise ValueError("Brakujący parametr: repo_name")
|
60 |
+
repo = user.create_repo(name=repo_name)
|
61 |
+
return f"Repozytorium {repo_name} utworzone: {repo.html_url}"
|
62 |
+
|
63 |
+
elif action == "create_file":
|
64 |
+
if not all([repo_name, path, content, message]):
|
65 |
+
raise ValueError(
|
66 |
+
"Brakujące parametry: repo_name, path, content, message")
|
67 |
+
repo = user.get_repo(repo_name)
|
68 |
+
repo.create_file(path, message, content, branch=branch)
|
69 |
+
return f"Plik {path} utworzony w {repo_name} na gałęzi {branch}"
|
70 |
+
|
71 |
+
elif action == "get_file":
|
72 |
+
if not all([repo_name, path]):
|
73 |
+
raise ValueError("Brakujące parametry: repo_name, path")
|
74 |
+
repo = user.get_repo(repo_name)
|
75 |
+
file_content = repo.get_contents(path)
|
76 |
+
return file_content.decoded_content.decode()
|
77 |
+
|
78 |
+
elif action == "delete_file":
|
79 |
+
if not all([repo_name, path]):
|
80 |
+
raise ValueError("Brakujące parametry: repo_name, path")
|
81 |
+
repo = user.get_repo(repo_name)
|
82 |
+
file_contents = repo.get_contents(path, ref=branch)
|
83 |
+
repo.delete_file(path, "Usunięcie pliku",
|
84 |
+
file_contents.sha, branch=branch)
|
85 |
+
return f"Plik {path} usunięty z {repo_name} na gałęzi {branch}"
|
86 |
+
|
87 |
+
elif action == "update_file":
|
88 |
+
if not all([repo_name, path, content, message]):
|
89 |
+
raise ValueError(
|
90 |
+
"Brakujące parametry: repo_name, path, content, message")
|
91 |
+
repo = user.get_repo(repo_name)
|
92 |
+
file_contents = repo.get_contents(path, ref=branch)
|
93 |
+
repo.update_file(path, message, content,
|
94 |
+
file_contents.sha, branch=branch)
|
95 |
+
return f"Plik {path} zaktualizowany w {repo_name} na gałęzi {branch}"
|
96 |
+
|
97 |
+
elif action == "list_branches":
|
98 |
+
if not repo_name:
|
99 |
+
raise ValueError("Brakujący parametr: repo_name")
|
100 |
+
repo = user.get_repo(repo_name)
|
101 |
+
branches = repo.get_branches()
|
102 |
+
return [branch.name for branch in branches]
|
103 |
+
|
104 |
+
elif action == "create_branch":
|
105 |
+
if not all([repo_name, base, head]): # base jako źródło, head jako nowa nazwa
|
106 |
+
raise ValueError("Brakujące parametry: repo_name, base, head")
|
107 |
+
repo = user.get_repo(repo_name)
|
108 |
+
source_branch = repo.get_branch(base)
|
109 |
+
repo.create_git_ref(ref=f"refs/heads/{head}",
|
110 |
+
sha=source_branch.commit.sha)
|
111 |
+
return f"Gałąź {head} utworzona z {base} w {repo_name}"
|
112 |
+
|
113 |
+
elif action == "delete_branch":
|
114 |
+
if not all([repo_name, branch]):
|
115 |
+
raise ValueError("Brakujące parametry: repo_name, branch")
|
116 |
+
repo = user.get_repo(repo_name)
|
117 |
+
repo.get_git_ref(f"heads/{branch}").delete()
|
118 |
+
return f"Gałąź {branch} usunięta z {repo_name}"
|
119 |
+
|
120 |
+
elif action == "create_pull_request":
|
121 |
+
if not all([repo_name, title, body, base, head]):
|
122 |
+
raise ValueError(
|
123 |
+
"Brakujące parametry: repo_name, title, body, base, head")
|
124 |
+
repo = user.get_repo(repo_name)
|
125 |
+
pr = repo.create_pull(title=title, body=body, base=base, head=head)
|
126 |
+
return f"Pull request utworzony: {pr.html_url}"
|
127 |
+
|
128 |
+
elif action == "list_open_pull_requests":
|
129 |
+
if not repo_name:
|
130 |
+
raise ValueError("Brakujący parametr: repo_name")
|
131 |
+
repo = user.get_repo(repo_name)
|
132 |
+
open_prs = repo.get_pulls(state='open')
|
133 |
+
return [{'title': pr.title, 'url': pr.html_url} for pr in open_prs]
|
134 |
+
|
135 |
+
elif action == "create_issue":
|
136 |
+
if not all([repo_name, title, body]):
|
137 |
+
raise ValueError("Brakujące parametry: repo_name, title, body")
|
138 |
+
repo = user.get_repo(repo_name)
|
139 |
+
issue = repo.create_issue(title=title, body=body)
|
140 |
+
return f"Issue utworzone: {issue.html_url}"
|
141 |
+
|
142 |
+
elif action == "list_issues":
|
143 |
+
if not repo_name:
|
144 |
+
raise ValueError("Brakujący parametr: repo_name")
|
145 |
+
repo = user.get_repo(repo_name)
|
146 |
+
issues = repo.get_issues(state='open')
|
147 |
+
return [{'title': issue.title, 'url': issue.html_url} for issue in issues]
|
148 |
+
|
149 |
+
elif action == "add_label_to_issue":
|
150 |
+
if not all([repo_name, issue_number, labels]):
|
151 |
+
raise ValueError(
|
152 |
+
"Brakujące parametry: repo_name, issue_number, labels")
|
153 |
+
repo = user.get_repo(repo_name)
|
154 |
+
issue = repo.get_issue(number=int(issue_number))
|
155 |
+
for label in labels.split(","):
|
156 |
+
issue.add_to_labels(label.strip())
|
157 |
+
return f"Etykiety dodane do issue #{issue_number} w {repo_name}"
|
158 |
+
|
159 |
+
elif action == "close_issue":
|
160 |
+
if not all([repo_name, issue_number]):
|
161 |
+
raise ValueError("Brakujące parametry: repo_name, issue_number")
|
162 |
+
repo = user.get_repo(repo_name)
|
163 |
+
issue = repo.get_issue(number=int(issue_number))
|
164 |
+
issue.edit(state='closed')
|
165 |
+
return f"Issue #{issue_number} zamknięte w {repo_name}"
|
166 |
+
|
167 |
+
elif action == "add_comment_to_issue":
|
168 |
+
if not all([repo_name, issue_number, message]): # message jako treść komentarza
|
169 |
+
raise ValueError(
|
170 |
+
"Brakujące parametry: repo_name, issue_number, message")
|
171 |
+
repo = user.get_repo(repo_name)
|
172 |
+
issue = repo.get_issue(number=int(issue_number))
|
173 |
+
issue.create_comment(body=message)
|
174 |
+
return f"Komentarz dodany do issue #{issue_number} w {repo_name}"
|
175 |
+
|
176 |
+
elif action == "create_release":
|
177 |
+
if not all([repo_name, tag, name, message]):
|
178 |
+
raise ValueError(
|
179 |
+
"Brakujące parametry: repo_name, tag, name, message")
|
180 |
+
repo = user.get_repo(repo_name)
|
181 |
+
release = repo.create_git_release(
|
182 |
+
tag=tag, name=name, message=message)
|
183 |
+
return f"Release {name} utworzone w {repo_name}: {release.html_url}"
|
184 |
+
|
185 |
+
elif action == "list_releases":
|
186 |
+
if not repo_name:
|
187 |
+
raise ValueError("Brakujący parametr: repo_name")
|
188 |
+
repo = user.get_repo(repo_name)
|
189 |
+
releases = repo.get_releases()
|
190 |
+
return [{'tag_name': release.tag_name, 'url': release.html_url} for release in releases]
|
191 |
+
|
192 |
+
elif action == "fork_repository":
|
193 |
+
if not repo_name:
|
194 |
+
raise ValueError("Brakujący parametr: repo_name")
|
195 |
+
repo = g.get_repo(repo_name) # Pobierz repozytorium do forkowania
|
196 |
+
fork = user.create_fork(repo)
|
197 |
+
return f"Fork repozytorium utworzony: {fork.html_url}"
|
198 |
+
|
199 |
+
elif action == "list_forks":
|
200 |
+
if not repo_name:
|
201 |
+
raise ValueError("Brakujący parametr: repo_name")
|
202 |
+
repo = g.get_repo(repo_name) # Pobierz repo, którego forki chcesz wyświetlić
|
203 |
+
forks = repo.get_forks()
|
204 |
+
return [{'full_name': fork.full_name, 'url': fork.html_url} for fork in forks]
|
205 |
+
|
206 |
+
elif action == "list_files":
|
207 |
+
if not all([owner, repo_name]):
|
208 |
+
raise ValueError("Brakujące parametry: owner, repo_name")
|
209 |
+
repo = g.get_repo(f"{owner}/{repo_name}")
|
210 |
+
contents = repo.get_contents(path)
|
211 |
+
files = [{'name': content.name, 'path': content.path,
|
212 |
+
'download_url': content.download_url} for content in contents]
|
213 |
+
return files
|
214 |
|
215 |
+
else:
|
216 |
+
raise ValueError(f"Nieznana akcja: {action}")
|
217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
except GithubException as e:
|
219 |
+
return f"Błąd GitHub: {str(e)}"
|
220 |
+
except ValueError as e:
|
221 |
+
return f"Błąd: {str(e)}"
|
222 |
|
223 |
|
224 |
with gr.Blocks() as demo:
|
225 |
+
with gr.Row():
|
226 |
+
action = gr.Dropdown(
|
227 |
+
choices=[
|
228 |
+
"import_repository",
|
229 |
+
"create_repository",
|
230 |
+
"create_file",
|
231 |
+
"get_file",
|
232 |
+
"delete_file",
|
233 |
+
"update_file",
|
234 |
+
"list_branches",
|
235 |
+
"create_branch",
|
236 |
+
"delete_branch",
|
237 |
+
"create_pull_request",
|
238 |
+
"list_open_pull_requests",
|
239 |
+
"create_issue",
|
240 |
+
"list_issues",
|
241 |
+
"add_label_to_issue",
|
242 |
+
"close_issue",
|
243 |
+
"add_comment_to_issue",
|
244 |
+
"create_release",
|
245 |
+
"list_releases",
|
246 |
+
"fork_repository",
|
247 |
+
"list_forks",
|
248 |
+
"list_files",
|
249 |
+
],
|
250 |
+
label="Akcja",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
)
|
252 |
+
repo_name = gr.Textbox(label="Nazwa repozytorium")
|
253 |
+
branch = gr.Textbox(label="Gałąź", value="main")
|
254 |
+
path = gr.Textbox(label="Ścieżka do pliku")
|
255 |
+
content = gr.Textbox(label="Zawartość pliku")
|
256 |
+
message = gr.Textbox(label="Wiadomość/Komentarz")
|
257 |
+
owner = gr.Textbox(label="Właściciel")
|
258 |
+
vcs_url = gr.Textbox(label="URL VCS")
|
259 |
+
title = gr.Textbox(label="Tytuł")
|
260 |
+
body = gr.Textbox(label="Treść")
|
261 |
+
base = gr.Textbox(label="Gałąź bazowa")
|
262 |
+
head = gr.Textbox(label="Gałąź docelowa/Nowa gałąź")
|
263 |
+
issue_number = gr.Number(label="Numer issue", precision=0)
|
264 |
+
labels = gr.Textbox(label="Etykiety (oddzielone przecinkami)")
|
265 |
+
tag = gr.Textbox(label="Tag")
|
266 |
+
release_name = gr.Textbox(label="Nazwa release") # Zmieniona nazwa
|
267 |
+
|
268 |
+
with gr.Row():
|
269 |
+
run_button = gr.Button("Wykonaj")
|
270 |
+
output = gr.Textbox(label="Wynik")
|
271 |
+
|
272 |
+
run_button.click(
|
273 |
+
github_tool,
|
274 |
+
inputs=[
|
275 |
+
action,
|
276 |
+
repo_name,
|
277 |
+
branch,
|
278 |
+
path,
|
279 |
+
content,
|
280 |
+
message,
|
281 |
+
owner,
|
282 |
+
vcs_url,
|
283 |
+
title,
|
284 |
+
body,
|
285 |
+
base,
|
286 |
+
head,
|
287 |
+
issue_number,
|
288 |
+
labels,
|
289 |
+
tag,
|
290 |
+
release_name, # Użycie zmienionej nazwy
|
291 |
+
],
|
292 |
+
outputs=output,
|
293 |
+
api_name="github_tool"
|
294 |
+
)
|
295 |
|
296 |
demo.launch()
|