@@ -74,71 +74,50 @@ def get_repo_node_id():
7474
7575def create_discussion (title , body , repo_node_id ):
7676 """Create a GitHub Discussion via GraphQL and return its node ID and URL."""
77- mutation = """
78- mutation($repoId: ID!, $categoryId: ID!, $title: String!, $body: String!) {
79- createDiscussion(input: {
80- repositoryId: $repoId,
81- categoryId: $categoryId,
82- title: $title,
83- body: $body
84- }) {
85- discussion {
86- id
87- url
77+ data = graphql (
78+ """
79+ mutation($repoId: ID!, $categoryId: ID!, $title: String!, $body: String!) {
80+ createDiscussion(input: {
81+ repositoryId: $repoId,
82+ categoryId: $categoryId,
83+ title: $title,
84+ body: $body
85+ }) {
86+ discussion {
87+ id
88+ url
89+ }
90+ }
8891 }
89- }
90- }
91- """
92- resp = requests .post (
93- GRAPHQL ,
94- headers = HEADERS ,
95- json = {
96- "query" : mutation ,
97- "variables" : {
98- "repoId" : repo_node_id ,
99- "categoryId" : CATEGORY_NODE_ID ,
100- "title" : title ,
101- "body" : body ,
102- },
92+ """ ,
93+ {
94+ "repoId" : repo_node_id ,
95+ "categoryId" : CATEGORY_NODE_ID ,
96+ "title" : title ,
97+ "body" : body ,
10398 },
10499 )
105- resp .raise_for_status ()
106- data = resp .json ()
107- if "errors" in data :
108- raise RuntimeError (f"GraphQL errors: { data ['errors' ]} " )
109- discussion = data ["data" ]["createDiscussion" ]["discussion" ]
100+ discussion = data ["createDiscussion" ]["discussion" ]
110101 return discussion ["id" ], discussion ["url" ]
111102
112103
113104def add_discussion_comment (discussion_id , body ):
114105 """Add a threaded comment to a Discussion via GraphQL."""
115- mutation = """
116- mutation($discussionId: ID!, $body: String!) {
117- addDiscussionComment(input: {
118- discussionId: $discussionId,
119- body: $body
120- }) {
121- comment {
122- id
106+ graphql (
107+ """
108+ mutation($discussionId: ID!, $body: String!) {
109+ addDiscussionComment(input: {
110+ discussionId: $discussionId,
111+ body: $body
112+ }) {
113+ comment {
114+ id
115+ }
116+ }
123117 }
124- }
125- }
126- """
127- resp = requests .post (
128- GRAPHQL ,
129- headers = HEADERS ,
130- json = {
131- "query" : mutation ,
132- "variables" : {
133- "discussionId" : discussion_id ,
134- "body" : body ,
135- },
136- },
118+ """ ,
119+ {"discussionId" : discussion_id , "body" : body },
137120 )
138- resp .raise_for_status ()
139- data = resp .json ()
140- if "errors" in data :
141- raise RuntimeError (f"GraphQL errors: { data ['errors' ]} " )
142121
143122
144123SEARCH_QUERY = """
@@ -253,30 +232,25 @@ def format_contributor_comment(
253232 for issue in issues_opened :
254233 lines .append (f"- [{ issue ['title' ]} ]({ issue ['html_url' ]} )" )
255234 else :
256- lines .append ("_No activity found — please edit to add yours._" )
235+ lines .append ("_No activity found — reply to add yours._" )
257236
258- # Fenced template for contributor to copy-paste and fill in
259237 lines .append ("" )
260- lines .append ("```" )
261238 lines .append ("### Focus" )
262- lines .append ("What are you working on this week? (please edit) " )
239+ lines .append ("_What are you working on this week? (reply to this thread)_ " )
263240 lines .append ("" )
264241 lines .append ("### Bottleneck" )
265- lines .append ("" )
266- lines .append (
267- "What is the single biggest bottleneck in progress toward your greater goal?"
268- )
269242 lines .append (
270- "Name your goal. Name the constraint. Name who or what can unblock it."
243+ "_What is the single biggest bottleneck in progress toward your "
244+ "greater goal? Name your goal. Name the constraint. Name who or "
245+ "what can unblock it._"
271246 )
272247 lines .append ("" )
273248 lines .append (
274- '(There\' s always one. Not just "waiting on review." Example: '
249+ '_ (There\' s always one. Not just "waiting on review." Example: '
275250 '"Goal: ship mailroom to production. Bottleneck: I need 30 min '
276251 "with @X to align on the ohttp-relay migration plan before I can "
277- 'write the PR.")'
252+ 'write the PR.")_ '
278253 )
279- lines .append ("```" )
280254 if bottlenecks :
281255 lines .append ("" )
282256 lines .append ("_Auto-detected signals:_" )
@@ -313,7 +287,7 @@ def main():
313287 body = (
314288 "Weekly standup — each contributor has a thread below "
315289 "with auto-gathered activity.\n \n "
316- "**Please review your thread and edit to add Focus and Bottleneck "
290+ "**Please review your thread and reply with your Focus and Bottleneck "
317291 "by end-of-day Monday (your timezone).**"
318292 )
319293 discussion_id , discussion_url = create_discussion (title , body , repo_node_id )
0 commit comments