File tree Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # ######################
4
+ # Author: Onkar
5
+ # Date: 28th Jan
6
+ # Version: v1
7
+
8
+ # #####################
9
+
10
+ # Shell script practice make use of github apis to intract with repo via command line
11
+ # List the users
12
+ # list the commits
13
+
14
+ # API endpoint
15
+ API_URL=" https://api.github.com"
16
+
17
+ # personal acess token and the username
18
+ USERNAME=$username
19
+ TOKEN=$token
20
+
21
+ # User and Repository information
22
+ REPO_USER=$1
23
+ REPO_NAME=$2
24
+
25
+ function github_api_get {
26
+ local endpoint=$1
27
+ local url=" ${API_URL} /${endpoint} "
28
+
29
+ curl -u " ${USERNAME} :${TOKEN} " " $url "
30
+ }
31
+
32
+ # function to list all the commits of the users of that pertuclar repo
33
+ function list_commits {
34
+ local endpoint=" repos/{$REPO_USER }/{$REPO_NAME }/commits"
35
+ result=$( github_api_get $endpoint )
36
+ echo " $result "
37
+
38
+ }
39
+ list_commits
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
+
You can’t perform that action at this time.
0 commit comments