-
Notifications
You must be signed in to change notification settings - Fork 25
/
gh_api_lib_user.sh
58 lines (55 loc) · 1.46 KB
/
gh_api_lib_user.sh
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
#!/bin/bash
# getUserProjectID queries the github api for the specific project uuid
# 1: username
# 2: project id (number)
function getUserProjectID() {
local USER=$1
local PROJECT_NUMBER=$2
gh api graphql -f query='
query($user: String!, $number: Int!) {
user(login: $user){
projectV2(number: $number) {
id
}
}
}' -f user=$USER -F number=$PROJECT_NUMBER | jq .data.user.projectV2.id | sed -e 's+"++g'
}
# getUserProjectFields queries the github api for the specific project fields
# 1: project id (uuid)
function getUserProjectFields() {
local PROJECT_ID=$1
gh api graphql -f query='
query($projectId: ID!){
node(id: $projectId) {
... on ProjectV2 {
fields(first: 100) {
nodes {
... on ProjectV2Field {
id
name
}
... on ProjectV2IterationField {
id
name
configuration {
iterations {
startDate
id
title
}
}
}
... on ProjectV2SingleSelectField {
id
name
options {
id
name
}
}
}
}
}
}
}' -f projectId=$PROJECT_ID | jq .data.node.fields > $TMP_STORE_LOCATION
}