Skip to content

Commit

Permalink
Merge pull request #1688 from majamassarini/fix/packit-service/1641
Browse files Browse the repository at this point in the history
Improve table on github check page

Fixes #1641

RELEASE NOTES BEGIN
Fixed the markdown table format in the github checks page. The table was broken when the user's repo was not allowed to use Packit.
RELEASE NOTES END

Reviewed-by: Laura Barcziová <None>
  • Loading branch information
softwarefactory-project-zuul[bot] authored Oct 11, 2022
2 parents cbd7540 + a9c0681 commit 911f4a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 9 additions & 1 deletion packit_service/worker/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from ogr.services.pagure import PagureProject

from packit_service.constants import (
DOCS_URL,
MSG_TABLE_HEADER_WITH_DETAILS,
)

Expand Down Expand Up @@ -378,12 +379,19 @@ def _create_table(
) -> str:
table_content = []
if url:
table_content.append(f"| Dashboard | {url} |\n")
type_of_url = ""
if "dashboard.packit.dev" in url or "dashboard.stg.packit.dev":
type_of_url = "Dashboard"
elif DOCS_URL in url:
type_of_url = "Documentation"
table_content.append(f"| {type_of_url} | {url} |\n")
if links_to_external_services is not None:
table_content += [
f"| {name} | {link} |\n"
for name, link in links_to_external_services.items()
]
if table_content:
table_content += "\n"

return (
MSG_TABLE_HEADER_WITH_DETAILS + "".join(table_content)
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,12 @@ def test_status_instead_check(

def test_create_table():
assert create_table_content(
"dashboard-url",
"dashboard.packit.dev-url",
{"Testing Farm": "tf-url", "COPR build": "copr-build-url"},
) == (
"| Name/Job | URL |\n"
"| --- | --- |\n"
"| Dashboard | dashboard-url |\n"
"| Dashboard | dashboard.packit.dev-url |\n"
"| Testing Farm | tf-url |\n"
"| COPR build | copr-build-url |\n"
"| COPR build | copr-build-url |\n\n"
)

0 comments on commit 911f4a2

Please sign in to comment.