-
Notifications
You must be signed in to change notification settings - Fork 0
/
close_issues.py
67 lines (52 loc) · 1.63 KB
/
close_issues.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Monday evening, move all issues from Scheduled to Closed
from biocypher import BioCypher
from scheduling.adapters.github_adapter import (
GitHubAdapter,
GitHubAdapterNodeType,
GitHubAdapterEdgeType,
GitHubAdapterIssueField,
)
import pandas as pd
pd.set_option("display.max_columns", None)
def main():
bc = BioCypher()
node_types = [
GitHubAdapterNodeType.ISSUE,
]
node_fields = [
GitHubAdapterIssueField.NUMBER,
GitHubAdapterIssueField.TITLE,
GitHubAdapterIssueField.BODY,
]
edge_types = [
GitHubAdapterEdgeType.PART_OF,
]
adapter = GitHubAdapter(
node_types=node_types,
node_fields=node_fields,
edge_types=edge_types,
)
bc.add_nodes(adapter.get_nodes())
bc.add_edges(adapter.get_edges())
dfs = bc.to_df()
# Filter issues with status "Scheduled"
dfs
scheduled_clubs = dfs["club"][dfs["club"]["status"] == "Scheduled"]
# Move all issues from Scheduled to Closed
for _id in scheduled_clubs["id"]:
adapter.mutate_column(_id, "Closed / Parked")
# Remove this week's schedule from README.md
with open("README.md", "r") as f:
lines = f.readlines()
for i, line in enumerate(lines):
if line.startswith("## Current Schedule"):
lines[i + 1] = (
"Next week's schedule will be posted on Tuesday at noon.\n"
)
# delete all lines after i+1
lines = lines[: i + 2]
break
with open("README.md", "w") as f:
f.writelines(lines)
if __name__ == "__main__":
main()