1- import os
21import sys
3- from pathlib import Path
42
53import typer
6- from typing_extensions import Annotated
74
85from bcbench .cli_options import EvaluationCategoryOption
6+ from bcbench .github_actions import write_step_outputs
97from bcbench .types import EvaluationCategory
108
119category_app = typer .Typer (help = "Category-specific configuration helpers" )
@@ -19,32 +17,26 @@ def list_categories() -> None:
1917
2018
2119@category_app .command ("bceval-config" )
22- def bceval_config (
23- category : EvaluationCategoryOption ,
24- github_output : Annotated [
25- Path | None ,
26- typer .Option (envvar = "GITHUB_OUTPUT" , help = "Append outputs to this file (typically $GITHUB_OUTPUT)" ),
27- ] = None ,
28- ) -> None :
20+ def bceval_config (category : EvaluationCategoryOption ) -> None :
2921 """
30- Print the bc-eval evaluator list and core score for a category as key=value lines .
22+ Emit the bc-eval evaluator list and core score for a category as step outputs .
3123
32- When run inside a GitHub Actions step with $GITHUB_OUTPUT set, the lines are
33- appended to that file so they become step outputs. Otherwise they're written
34- to stdout.
24+ The lines are appended to $GITHUB_OUTPUT so they become GitHub Actions step outputs. Outside of Actions nothing is written.
3525 """
36- lines : list [str ] = [
37- f"evaluators={ ',' .join (category .evaluators )} " ,
38- f"core_score={ category .core_score } " ,
39- ]
40- payload : str = "\n " .join (lines ) + "\n "
41-
42- if github_output :
43- with open (github_output , "a" , encoding = "utf-8" ) as file :
44- file .write (payload )
45- else :
46- sys .stdout .write (payload )
47-
48- # Always echo to stderr so workflow logs show what was emitted.
49- if os .getenv ("GITHUB_ACTIONS" ):
50- sys .stderr .write (payload )
26+ write_step_outputs (
27+ {
28+ "evaluators" : "," .join (category .evaluators ),
29+ "core_score" : category .core_score ,
30+ }
31+ )
32+
33+
34+ @category_app .command ("runtime-config" )
35+ def runtime_config (category : EvaluationCategoryOption ) -> None :
36+ """Emit the GitHub Actions runner label and container requirement for a category."""
37+ write_step_outputs (
38+ {
39+ "runner" : category .runner ,
40+ "requires-container" : str (category .requires_container ).lower (),
41+ }
42+ )
0 commit comments