File tree 1 file changed +32
-0
lines changed
AutomationScripts/Github Bot
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ from github import Github
2
+ #user login
3
+ g = Github ("username" ,"password" )
4
+
5
+
6
+ #showing all the repositories of python
7
+ repos = g .search_repositories (query = "language:python" )
8
+ for i in repos :
9
+ print (i )
10
+
11
+ #for getting all the repos of user
12
+ for repo in g .get_user ().get_repos ():
13
+ print (repo .name )
14
+
15
+ #shows the no. of star of the repo
16
+ repo = g .get_repo ("repository name" )
17
+ repo .stargazers_count
18
+
19
+ #getting all the contents of particular repo
20
+ content = repo .get_contents ("" )
21
+ for content_fil in content :
22
+ print (content_fil )
23
+
24
+ #making a repo test and creating test file
25
+ user = g .get_user ()
26
+ repo = user .create_repo ('test' )
27
+ repo .create_file ("test.txt" ,"commit" ,"hello coders" )
28
+
29
+ #deleting file from the repo
30
+ repo = g .get_repo ("" )#enter repository name inside the bracket
31
+ cont = repo .get_contents ("test.txt" )
32
+ repo .delete_file (cont .path ,"remove test" ,cont .sha ,branch = 'master' )
You can’t perform that action at this time.
0 commit comments