1616NOTIFY = ROOT / "scripts" / "action" / "notify-setup-ready.sh"
1717
1818PULLS = {
19- "412" : {"state" : "open" , "head" : {"repo" : {"full_name" : "owner/repo" }, "sha" : "h412" }, "base" : {"ref" : "main" , "sha" : "t" }, "title" : "Retry failed webhooks" },
20- "409" : {"state" : "open" , "head" : {"repo" : {"full_name" : "owner/repo" }, "sha" : "h409" }, "base" : {"ref" : "main" , "sha" : "t" }, "title" : "Split ledger" },
21- "401" : {"state" : "open" , "head" : {"repo" : {"full_name" : "owner/repo" }, "sha" : "h401" }, "base" : {"ref" : "main" , "sha" : "t" }, "title" : "Bump SDK" },
22- "400" : {"state" : "open" , "head" : {"repo" : {"full_name" : "owner/repo" }, "sha" : "h400" }, "base" : {"ref" : "main" , "sha" : "t" }, "title" : "Fourth" },
23- "377" : {"state" : "open" , "head" : {"repo" : {"full_name" : "someone/fork" }, "sha" : "h377" }, "base" : {"ref" : "main" , "sha" : "t" }, "title" : "From a fork" },
24- "350" : {"state" : "closed" , "head" : {"repo" : {"full_name" : "owner/repo" }, "sha" : "h350" }, "base" : {"ref" : "main" , "sha" : "t" }, "title" : "Closed" },
25- "340" : {"state" : "open" , "head" : {"repo" : {"full_name" : "owner/repo" }, "sha" : "h340" }, "base" : {"ref" : "release" , "sha" : "t" }, "title" : "Other branch" },
19+ "412" : {
20+ "state" : "open" ,
21+ "head" : {"repo" : {"full_name" : "owner/repo" }, "sha" : "h412" },
22+ "base" : {"ref" : "main" , "sha" : "t" },
23+ "title" : "Retry failed webhooks" ,
24+ },
25+ "409" : {
26+ "state" : "open" ,
27+ "head" : {"repo" : {"full_name" : "owner/repo" }, "sha" : "h409" },
28+ "base" : {"ref" : "main" , "sha" : "t" },
29+ "title" : "Split ledger" ,
30+ },
31+ "401" : {
32+ "state" : "open" ,
33+ "head" : {"repo" : {"full_name" : "owner/repo" }, "sha" : "h401" },
34+ "base" : {"ref" : "main" , "sha" : "t" },
35+ "title" : "Bump SDK" ,
36+ },
37+ "400" : {
38+ "state" : "open" ,
39+ "head" : {"repo" : {"full_name" : "owner/repo" }, "sha" : "h400" },
40+ "base" : {"ref" : "main" , "sha" : "t" },
41+ "title" : "Fourth" ,
42+ },
43+ "377" : {
44+ "state" : "open" ,
45+ "head" : {"repo" : {"full_name" : "someone/fork" }, "sha" : "h377" },
46+ "base" : {"ref" : "main" , "sha" : "t" },
47+ "title" : "From a fork" ,
48+ },
49+ "350" : {
50+ "state" : "closed" ,
51+ "head" : {"repo" : {"full_name" : "owner/repo" }, "sha" : "h350" },
52+ "base" : {"ref" : "main" , "sha" : "t" },
53+ "title" : "Closed" ,
54+ },
55+ "340" : {
56+ "state" : "open" ,
57+ "head" : {"repo" : {"full_name" : "owner/repo" }, "sha" : "h340" },
58+ "base" : {"ref" : "release" , "sha" : "t" },
59+ "title" : "Other branch" ,
60+ },
2661}
2762
2863
@@ -90,7 +125,10 @@ def _entry(self, n: int) -> dict:
90125 def test_the_listed_pull_requests_are_previewed_in_order (self ) -> None :
91126 out = self ._run ("Adds CodeBoarding.\n \n <!-- codeboarding:preview 412,409 -->\n " )
92127 self .assertEqual (out , {"count" : "2" , "prs" : "412,409" })
93- self .assertEqual (self ._entry (1 ), {"pr_number" : "412" , "head_sha" : "h412" , "merge_base_sha" : "mb-h412" , "title" : "Retry failed webhooks" })
128+ self .assertEqual (
129+ self ._entry (1 ),
130+ {"pr_number" : "412" , "head_sha" : "h412" , "merge_base_sha" : "mb-h412" , "title" : "Retry failed webhooks" },
131+ )
94132 self .assertEqual (self ._entry (2 )["pr_number" ], "409" )
95133
96134 def test_forks_closed_and_other_branches_are_skipped_and_the_list_is_capped (self ) -> None :
@@ -135,7 +173,9 @@ def setUp(self) -> None:
135173 (self .base_dir / "analysis.json" ).write_text ('{"components": []}' )
136174 self .review_dir = self .root / "review-artifact"
137175 self .review_dir .mkdir ()
138- (self .review_dir / "metadata.json" ).write_text (json .dumps ({"base_artifact" : "cb-base-Z" , "base_artifact_id" : "77" }))
176+ (self .review_dir / "metadata.json" ).write_text (
177+ json .dumps ({"base_artifact" : "cb-base-Z" , "base_artifact_id" : "77" })
178+ )
139179
140180 # The action tree with the engine and renderer stubbed; the packager is the real one.
141181 action = self .action = self .root / "action"
@@ -150,7 +190,9 @@ def setUp(self) -> None:
150190 encoding = "utf-8" ,
151191 )
152192 analyze .chmod (0o755 )
153- (action / "scripts" / "diff_to_mermaid.py" ).write_text ('print(\' {"n_changed": 1, "analysed_files_changed": 1}\' )\n ' )
193+ (action / "scripts" / "diff_to_mermaid.py" ).write_text (
194+ 'print(\' {"n_changed": 1, "analysed_files_changed": 1}\' )\n '
195+ )
154196
155197 self .preview_dir = self .root / "codeboarding-preview"
156198 self .preview_dir .mkdir ()
@@ -159,8 +201,16 @@ def tearDown(self) -> None:
159201 self .temp_dir .cleanup ()
160202
161203 def _run (self , pr_head : str | None = None ) -> dict [str , str ]:
162- (self .preview_dir / "1.json" ).write_text (json .dumps (
163- {"pr_number" : "412" , "head_sha" : pr_head or self .pr_head , "merge_base_sha" : self .fork_point , "title" : "Retry failed webhooks" }))
204+ (self .preview_dir / "1.json" ).write_text (
205+ json .dumps (
206+ {
207+ "pr_number" : "412" ,
208+ "head_sha" : pr_head or self .pr_head ,
209+ "merge_base_sha" : self .fork_point ,
210+ "title" : "Retry failed webhooks" ,
211+ }
212+ )
213+ )
164214 output = self .root / "output"
165215 output .write_text ("" )
166216 subprocess .run (
@@ -233,9 +283,14 @@ def test_the_email_links_the_first_reviewed_pull_request(self) -> None:
233283 [str (NOTIFY )],
234284 env = {
235285 "PATH" : f"{ root / 'bin' } :{ os .environ ['PATH' ]} " ,
236- "REPOSITORY" : "owner/repo" , "PR_NUMBER" : "418" , "PR_AUTHOR" : "maria-k" ,
237- "HEAD_REF" : "codeboarding/setup-action" , "BASE_REF" : "main" ,
238- "FIRST_PR" : "412" , "FIRST_TITLE" : "Retry failed webhooks" , "PREVIEW_PRS" : "412,409,401" ,
286+ "REPOSITORY" : "owner/repo" ,
287+ "PR_NUMBER" : "418" ,
288+ "PR_AUTHOR" : "maria-k" ,
289+ "HEAD_REF" : "codeboarding/setup-action" ,
290+ "BASE_REF" : "main" ,
291+ "FIRST_PR" : "412" ,
292+ "FIRST_TITLE" : "Retry failed webhooks" ,
293+ "PREVIEW_PRS" : "412,409,401" ,
239294 },
240295 check = True ,
241296 capture_output = True ,
0 commit comments