Skip to content

Commit eb6431c

Browse files
stubsabot: warn if stubtest won't test an update (#8681)
Co-authored-by: Shantanu <[email protected]>
1 parent 8e4b89a commit eb6431c

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

scripts/stubsabot.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import subprocess
1313
import sys
1414
import tarfile
15+
import textwrap
1516
import urllib.parse
1617
import zipfile
1718
from dataclasses import dataclass
@@ -320,12 +321,27 @@ async def suggest_typeshed_update(update: Update, session: aiohttp.ClientSession
320321
return
321322

322323
body = "\n".join(f"{k}: {v}" for k, v in update.links.items())
323-
body += """
324324

325-
If stubtest fails for this PR:
326-
- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR)
327-
- Fix stubtest failures in another PR, then close this PR
328-
"""
325+
stubtest_will_run = not meta.get("stubtest", {}).get("skip", False)
326+
if stubtest_will_run:
327+
body += textwrap.dedent(
328+
"""
329+
330+
If stubtest fails for this PR:
331+
- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR)
332+
- Fix stubtest failures in another PR, then close this PR
333+
334+
Note that you will need to close and re-open the PR in order to trigger CI
335+
"""
336+
)
337+
else:
338+
body += textwrap.dedent(
339+
f"""
340+
341+
:warning: Review this PR manually, as stubtest is skipped in CI for {update.distribution}! :warning:
342+
"""
343+
)
344+
329345
await create_or_update_pull_request(title=title, body=body, branch_name=branch_name, session=session)
330346

331347

0 commit comments

Comments
 (0)