hive-forge: print the ref ci-runs --branch resolved to

qualify_ref (ci_runs.rs:84-93) reads '#N' and an all-digit value as a PR,
anything else as a branch — so '--branch #4540' and '--branch
ops-4502-swarm-agent-icon' for the same PR/head commit answer two disjoint
questions with no indication which one was asked. Print the resolved ref
to stderr whenever --branch is given, so the output states which question
it answered.

Stdout is untouched in both plain and --json mode, so no existing
invocation's parsed output changes. An all-digit branch name stays
reachable via --branch refs/heads/<name> (already documented, unchanged).
This commit is contained in:
atlas 2026-09-20 17:28:49 +02:00 committed by mara
commit 8e6c813325

View file

@ -41,9 +41,13 @@ pub struct Args {
/// Returns an error if the list request fails (network, or a non-2xx).
pub fn run(client: &Client, args: Args) -> Result<()> {
let (owner, name) = client.owner_repo()?;
let qualified_ref = args.branch.as_deref().map(qualify_ref);
if let (Some(given), Some(resolved)) = (args.branch.as_deref(), qualified_ref.as_deref()) {
eprintln!("hive-forge: --branch {given:?} -> {resolved}");
}
let query = ListActionRunsQuery {
workflow_id: args.workflow.clone(),
r#ref: args.branch.as_deref().map(qualify_ref),
r#ref: qualified_ref,
..Default::default()
};
let body = client