Update prtester.py

This commit is contained in:
Bocki 2024-10-14 11:25:51 +02:00 committed by GitHub
parent aa1aa1581b
commit 87b9fe490f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

8
.github/prtester.py vendored
View File

@ -4,7 +4,8 @@ import re
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from datetime import datetime from datetime import datetime
from typing import Iterable from typing import Iterable
import os.path #import os.path
import os
import urllib import urllib
# This script is specifically written to be used in automation for https://github.com/RSS-Bridge/rss-bridge # This script is specifically written to be used in automation for https://github.com/RSS-Bridge/rss-bridge
@ -39,7 +40,8 @@ def main(instances: Iterable[Instance], with_upload: bool, with_reduced_upload:
def testBridges(instance: Instance, bridge_cards: Iterable, with_upload: bool, with_reduced_upload: bool) -> Iterable: def testBridges(instance: Instance, bridge_cards: Iterable, with_upload: bool, with_reduced_upload: bool) -> Iterable:
instance_suffix = '' instance_suffix = ''
tester_url = 'https://bockiii.github.io/prs/' prid = os.environ.get("PR")
tester_url = f'https://bockiii.github.io/prs/{prid}/'
if instance.name: if instance.name:
instance_suffix = f' ({instance.name})' instance_suffix = f' ({instance.name})'
table_rows = [] table_rows = []
@ -144,7 +146,7 @@ def testBridges(instance: Instance, bridge_cards: Iterable, with_upload: bool, w
filename = f'{os.getcwd()}/{instance.name}_{form_number}.html' filename = f'{os.getcwd()}/{instance.name}_{form_number}.html'
with open(file=filename, mode='wb') as file: with open(file=filename, mode='wb') as file:
file.write(page_text) file.write(page_text)
table_rows.append(f'| {bridge_name} | [{form_number} {context_name}{instance_suffix}]({tester_url}) | {status} |') table_rows.append(f'| {bridge_name} | [{form_number} {context_name}{instance_suffix}]({tester_url}/{filename}) | {status} |')
form_number += 1 form_number += 1
return table_rows return table_rows