-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
::by sergio giraldo @ 20240512T2227CEST, gpg signed
- Loading branch information
1 parent
a8d8118
commit e0f533f
Showing
3 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.0.130 | ||
0.0.131 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/usr/bin/python3 | ||
|
||
import subprocess | ||
import json | ||
|
||
# Execute the command-line command | ||
command = """ | ||
gh api graphql -f query=' | ||
query{ | ||
node(id: "PVT_kwHOABF2LM4AhB76") { | ||
... on ProjectV2 { | ||
items(first: 20) { | ||
nodes{ | ||
fieldValues(last: 5) { | ||
nodes{ | ||
... on ProjectV2ItemFieldTextValue { | ||
field { | ||
... on ProjectV2FieldCommon { | ||
name | ||
} | ||
} | ||
} | ||
... on ProjectV2ItemFieldDateValue { | ||
field { | ||
... on ProjectV2FieldCommon { | ||
name | ||
} | ||
} | ||
} | ||
... on ProjectV2ItemFieldSingleSelectValue { | ||
name | ||
field { | ||
... on ProjectV2FieldCommon { | ||
name | ||
} | ||
} | ||
} | ||
} | ||
} | ||
content{ | ||
... on DraftIssue { | ||
title | ||
} | ||
...on Issue { | ||
title | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}' | ||
""" | ||
result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
|
||
# Check if the command executed successfully | ||
if result.returncode == 0: | ||
# Decode the output from bytes to string | ||
output = result.stdout.decode("utf-8") | ||
|
||
# Parse the output as JSON | ||
json_data = json.loads(output) | ||
|
||
statuses = set() | ||
status_counts = {} | ||
|
||
items = (json_data["data"]["node"]["items"]["nodes"]) | ||
for item in items: | ||
status = item["fieldValues"]["nodes"][-1]["name"] | ||
statuses.add(status) | ||
|
||
# Increment the count for the current status | ||
status_counts[status] = status_counts.get(status, 0) + 1 | ||
|
||
# print(item["fieldValues"]["nodes"][-1]["name"]) | ||
# print("-") | ||
# print((item["content"]["title"])) | ||
# print("\n--------\n") | ||
|
||
for status in statuses: | ||
if status != "Done": | ||
print(status, status_counts[status]) | ||
|
||
else: | ||
# Handle command execution error | ||
error_message = result.stderr.decode('utf-8') | ||
print(f"Error: {error_message}") |