Handle quote marks ' " in PR titles in benchmark CI (#2877)
* escape double quote marks in PR title * move the pr title into the env
This commit is contained in:
parent
6a071a27e2
commit
fa99407b81
9
.github/workflows/benchmarks.yml
vendored
9
.github/workflows/benchmarks.yml
vendored
@ -119,8 +119,11 @@ jobs:
|
|||||||
- name: Upload benchmark results
|
- name: Upload benchmark results
|
||||||
# Only run if the database creds are available in this context.
|
# Only run if the database creds are available in this context.
|
||||||
if: ${{ env.DATABASE_URL }}
|
if: ${{ env.DATABASE_URL }}
|
||||||
run: poetry run python scripts/simple_app_benchmark_upload.py --os "${{ matrix.os }}"
|
env:
|
||||||
--python-version "${{ matrix.python-version }}" --commit-sha "${{ github.sha }}"
|
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||||
--benchmark-json "${{ env.OUTPUT_FILE }}" --pr-title "${{ github.event.pull_request.title }}"
|
run:
|
||||||
|
poetry run python scripts/simple_app_benchmark_upload.py --os "${{ matrix.os }}"
|
||||||
|
--python-version "${{ matrix.python-version }}" --commit-sha "${{ github.sha }}"
|
||||||
|
--benchmark-json "${{ env.OUTPUT_FILE }}"
|
||||||
--db-url "${{ env.DATABASE_URL }}" --branch-name "${{ github.head_ref || github.ref_name }}"
|
--db-url "${{ env.DATABASE_URL }}" --branch-name "${{ github.head_ref || github.ref_name }}"
|
||||||
--event-type "${{ github.event_name }}" --actor "${{ github.actor }}"
|
--event-type "${{ github.event_name }}" --actor "${{ github.actor }}"
|
||||||
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import psycopg2
|
import psycopg2
|
||||||
@ -103,7 +104,11 @@ 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(
|
||||||
@ -127,7 +132,6 @@ def main():
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--pr-title",
|
"--pr-title",
|
||||||
help="The PR title to insert into the database.",
|
help="The PR title to insert into the database.",
|
||||||
required=True,
|
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--branch-name",
|
"--branch-name",
|
||||||
@ -146,6 +150,10 @@ def main():
|
|||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
pr_title = args.pr_title or os.getenv("PR_TITLE")
|
||||||
|
if not 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)
|
||||||
# Insert the data into the database
|
# Insert the data into the database
|
||||||
@ -155,7 +163,7 @@ def main():
|
|||||||
python_version=args.python_version,
|
python_version=args.python_version,
|
||||||
performance_data=cleaned_benchmark_results,
|
performance_data=cleaned_benchmark_results,
|
||||||
commit_sha=args.commit_sha,
|
commit_sha=args.commit_sha,
|
||||||
pr_title=args.pr_title,
|
pr_title=pr_title,
|
||||||
branch_name=args.branch_name,
|
branch_name=args.branch_name,
|
||||||
event_type=args.event_type,
|
event_type=args.event_type,
|
||||||
actor=args.actor,
|
actor=args.actor,
|
||||||
|
Loading…
Reference in New Issue
Block a user