Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions templates/_templating_scripting.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@
"pre-commit-ci[bot]",
"app/pre-commit-ci",
"app/scitools-ci",
"web-flow",
]
TEMPLATING_HEADING = f"## [Templating]({SCITOOLS_URL}/.github/blob/main/templates)"
TEMPLATING_HEADING = (
"[TEMPLATING WATERMARK]: #\n\n"
f"## [Templating]({SCITOOLS_URL}/.github/blob/main/templates)"
)

_MAGIC_PREFIX = "@scitools-templating: please"
MAGIC_NO_PROMPT = re.compile(rf"{_MAGIC_PREFIX} no share prompt", re.IGNORECASE)
Expand Down Expand Up @@ -227,9 +231,6 @@ def prompt_share(args: argparse.Namespace) -> None:
# Can use a URL here for local debugging:
# pr_number = "https://github.com/SciTools/iris/pull/6901"

# current_user = gh_json("api user")["login"]
current_user = "scitools-ci" # Temporary testing patch.

body = gh_json(f"pr view {pr_number}", "body")["body"]
if MAGIC_NO_PROMPT.search(body):
print(
Expand Down Expand Up @@ -275,8 +276,7 @@ def post_review(review_body: str, review_type: ReviewType) -> None:
existing_reviews = json.loads(check_output(shlex.split(gh_command)))
reviews_to_edit = [
review for review in existing_reviews
if review["user"]["login"] == current_user
and review["body"].startswith(TEMPLATING_HEADING)
if review["body"].startswith(TEMPLATING_HEADING)
]
if reviews_to_edit:
# Edit the last existing review.
Expand Down
Loading