8000 Add files via upload · CodeClasher/githubAPI@fddba05 · GitHub
[go: up one dir, main page]

Skip to content

Commit fddba05

Browse files
Add files via upload
1 parent 00562a9 commit fddba05

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

githubApiUsage.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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+

0 commit comments

Comments
 (0)
0