-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_issue_list_pv2.py
48 lines (41 loc) · 1.45 KB
/
update_issue_list_pv2.py
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
import requests
# Replace with your GitHub Personal Access Token and repository details
ACCESS_TOKEN = "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"
REPO_OWNER = "RhoderickGalero"
REPO_NAME = "Practice"
def get_repository_issues():
url = "https://api.github.com/graphql"
headers = {
"Authorization": f"Bearer {ACCESS_TOKEN}"
}
query = """
mutation UpdateProjectItemField {
updateProjectV2ItemFieldValue(input: (
input: {projectId: "PVT_kwHOBbg8Ns4AT02a", itemId: "PVTI_lAHOBbg8Ns4AT02azgIj6xo", fieldId: "PVTSSF_lAHOBbg8Ns4AT02azgMqiD8", value: {singleSelectOptionId: "47fc9ee4"}, clientMutationId: ""}
) {
clientMutationId
}
}
"""
response = requests.post(url, json={"query": query}, headers=headers)
print (response)
if response.status_code == 200:
data = response.json()
print (data)
# issues = data["data"]["repository"]["projectV2"]["items"]["edges"]
# print (issues)
# return issues
else:
print("Failed to retrieve issues:", response.text)
return None
if __name__ == "__main__":
issues = get_repository_issues()
'''
for item in issues:
assignees_edges = item['node']['content']['assignees']['edges']
if assignees_edges:
node_id = item['node']['id']
print (node_id)
# empty_assignees_node_ids.append(node_id)
#print(empty_assignees_node_ids)
'''