From eb6431c4cc1e26d05da61e8b8228ee7ab14e6200 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sun, 4 Sep 2022 21:56:58 +0100 Subject: [PATCH] stubsabot: warn if stubtest won't test an update (#8681) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> --- scripts/stubsabot.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/scripts/stubsabot.py b/scripts/stubsabot.py index d83d3c8da..c59565f16 100644 --- a/scripts/stubsabot.py +++ b/scripts/stubsabot.py @@ -12,6 +12,7 @@ import re import subprocess import sys import tarfile +import textwrap import urllib.parse import zipfile from dataclasses import dataclass @@ -320,12 +321,27 @@ async def suggest_typeshed_update(update: Update, session: aiohttp.ClientSession return body = "\n".join(f"{k}: {v}" for k, v in update.links.items()) - body += """ -If stubtest fails for this PR: -- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR) -- Fix stubtest failures in another PR, then close this PR -""" + stubtest_will_run = not meta.get("stubtest", {}).get("skip", False) + if stubtest_will_run: + body += textwrap.dedent( + """ + + If stubtest fails for this PR: + - Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR) + - Fix stubtest failures in another PR, then close this PR + + Note that you will need to close and re-open the PR in order to trigger CI + """ + ) + else: + body += textwrap.dedent( + f""" + + :warning: Review this PR manually, as stubtest is skipped in CI for {update.distribution}! :warning: + """ + ) + await create_or_update_pull_request(title=title, body=body, branch_name=branch_name, session=session)