make PR title optional since push event or PR merge will not have the title (#2889)

This commit is contained in:
Martin Xu 2024-03-20 16:38:09 -07:00 committed by GitHub
parent f39c138bfa
commit f80d7978d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -104,11 +104,7 @@ def insert_benchmarking_data(
def main(): def main():
"""Runs the benchmarks and inserts the results. """Runs the benchmarks and inserts the results."""
Raises:
ValueError: If the PR title is not provided.
"""
# Get the commit SHA and JSON directory from the command line arguments # Get the commit SHA and JSON directory from the command line arguments
parser = argparse.ArgumentParser(description="Run benchmarks and process results.") parser = argparse.ArgumentParser(description="Run benchmarks and process results.")
parser.add_argument( parser.add_argument(
@ -150,9 +146,8 @@ def main():
) )
args = parser.parse_args() args = parser.parse_args()
pr_title = args.pr_title or os.getenv("PR_TITLE") # Get the PR title from env or the args. For the PR merge or push event, there is no PR title, leaving it empty.
if not pr_title: pr_title = args.pr_title or os.getenv("PR_TITLE", "")
raise ValueError("PR title is required")
# Get the results of pytest benchmarks # Get the results of pytest benchmarks
cleaned_benchmark_results = extract_stats_from_json(args.benchmark_json) cleaned_benchmark_results = extract_stats_from_json(args.benchmark_json)