Skip to content

Commit

Permalink
fixed github tokens being broken (#326)
Browse files Browse the repository at this point in the history
* fixed github tokens being broken

* conditionally removed links
  • Loading branch information
Snooz82 authored Dec 7, 2024
1 parent 504e6fa commit 54fa5ac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
15 changes: 12 additions & 3 deletions public/pyworker/runRobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from importlib import import_module, reload
from io import StringIO
from pathlib import Path

def log(message):
js.postMessage(json.dumps({"std_output": message}))

Expand All @@ -20,18 +20,21 @@ def log(message):
try:
import robot
from robot.libdocpkg import LibraryDocumentation
from robot.conf import RobotSettings
except ImportError:
robot = None

if robot is None:
log(f"Install Robot Framework")
rf_version = f"=={version}" if version else ""
requirements_list.insert(0, f"robotframework{rf_version}")
if not [req for req in requirements_list if req.split('==')[0] == 'robotframework']:
rf_version = f"=={version}" if version else ""
requirements_list.insert(0, f"robotframework{rf_version}")
try:
await micropip.install(requirements_list, keep_going=True)
time.sleep(1)
import robot
from robot.libdocpkg import LibraryDocumentation
from robot.conf import RobotSettings
log(f" = version {robot.__version__}\n")
except Exception as e:
js.console.log(f"Installation Exception: {e}")
Expand Down Expand Up @@ -111,6 +114,8 @@ def write_file(file):
js.console.log(f"Files in working dir: {os.listdir('.')}")
result = -2

console_links_enabled = "ConsoleLinks" in RobotSettings._cli_opts

try:
if test_case_name:
kwargs = {"test": test_case_name}
Expand All @@ -122,9 +127,13 @@ def write_file(file):
if robot_arguments:
log(f"Robot Run Arguments: {robot_args}\n")
log(f"\nRunning Robot Framework:\n")
if console_links_enabled:
robot_arguments["consolelinks"] = 'off'
else:
log(f"> robot --loglevel TRACE:INFO --exclude EXCL --skip SKIP\n"
f" --removekeywords tag:REMOVE --flattenkeywords tag:FLAT{testcli} .\n")
if console_links_enabled:
kwargs["consolelinks"] = 'off'

org_stdout = sys.__stdout__
org_stderr = sys.__stderr__
Expand Down
6 changes: 4 additions & 2 deletions src/js/code/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const getProjectFromLiveDir = async(projectDir) => {

const getProject = async(projectUrl) => {
console.log(`Loading data from ${projectUrl}`)
const configFile = await fetch(`${projectUrl}/config.json?token=${Date.now()}`)
// const configFile = await fetch(`${projectUrl}/config.json?token=${Date.now()}`)
const configFile = await fetch(`${projectUrl}/config.json`)
.then(response => response.json())
const project = { name: configFile.name, files: [], description: '' }
if (configFile.robotVersion) {
Expand All @@ -48,7 +49,8 @@ const getProject = async(projectUrl) => {
}
for (const file of configFile.files) {
const { fileName, hidden } = file
const content = await fetch(`${projectUrl}/${fileName}?token=${Date.now()}`)
// const content = await fetch(`${projectUrl}/${fileName}?token=${Date.now()}`)
const content = await fetch(`${projectUrl}/${fileName}`)
.then(response => response.text())
project.files.push({
fileName,
Expand Down

0 comments on commit 54fa5ac

Please sign in to comment.