You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by dr...@apache.org on 2022/09/20 15:11:09 UTC
[tvm] branch main updated: [ci] Lint PR title/body for @ tags (#12840)
This is an automated email from the ASF dual-hosted git repository.
driazati pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new ecd003c742 [ci] Lint PR title/body for @ tags (#12840)
ecd003c742 is described below
commit ecd003c742da85d4945c7d02e9301e07ad413136
Author: driazati <94...@users.noreply.github.com>
AuthorDate: Tue Sep 20 08:10:59 2022 -0700
[ci] Lint PR title/body for @ tags (#12840)
This ensures that no users are tagged directly in PR titles or
descriptions, which lets us finally turn this on
https://github.blog/changelog/2022-08-23-new-options-for-controlling-the-default-commit-message-when-merging-a-pull-request/
---
ci/scripts/check_pr.py | 18 ++++++++----------
tests/python/ci/test_ci.py | 12 ++++++++++++
2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/ci/scripts/check_pr.py b/ci/scripts/check_pr.py
index 9af5ec5580..8be5c0ee46 100755
--- a/ci/scripts/check_pr.py
+++ b/ci/scripts/check_pr.py
@@ -69,19 +69,17 @@ def trailing_period(s: str):
title_checks = [
Check(check=non_empty, error_fn=lambda d: "PR must have a title but title was empty"),
Check(check=trailing_period, error_fn=lambda d: "PR must not end in a tailing '.'"),
- # TODO(driazati): enable this check once https://github.com/apache/tvm/issues/12637 is done
- # Check(
- # check=usernames,
- # error_fn=lambda d: f"PR title must not tag anyone but found these usernames: {d}",
- # ),
+ Check(
+ check=usernames,
+ error_fn=lambda d: f"PR title must not tag anyone but found these usernames: {d}",
+ ),
]
body_checks = [
Check(check=non_empty, error_fn=lambda d: "PR must have a body but body was empty"),
- # TODO(driazati): enable this check once https://github.com/apache/tvm/issues/12637 is done
- # Check(
- # check=usernames,
- # error_fn=lambda d: f"PR body must not tag anyone but found these usernames: {d}",
- # ),
+ Check(
+ check=usernames,
+ error_fn=lambda d: f"PR body must not tag anyone but found these usernames: {d}",
+ ),
]
diff --git a/tests/python/ci/test_ci.py b/tests/python/ci/test_ci.py
index 4b8c5d9ad4..8c7c9f6bb4 100644
--- a/tests/python/ci/test_ci.py
+++ b/tests/python/ci/test_ci.py
@@ -1327,6 +1327,18 @@ def test_should_rebuild_docker(tmpdir_factory, changed_files, name, check, expec
expected="non_empty: FAILED",
expected_code=1,
),
+ user_title=dict(
+ title="[something] a change @someon",
+ body="hello",
+ expected="usernames: FAILED: PR title must not tag",
+ expected_code=1,
+ ),
+ user_body=dict(
+ title="[something] a change",
+ body="hello\n\n cc @someone",
+ expected="usernames: FAILED: PR body must not tag",
+ expected_code=1,
+ ),
)
def test_pr_linter(title, body, expected, expected_code):
"""