From 6554fb22bfe1d4ebdc17ed7911aeeecf00113d55 Mon Sep 17 00:00:00 2001 From: Olivier Cots Date: Fri, 13 Nov 2026 21:00:48 +0100 Subject: [PATCH] release: the comment of phase 2 links the run to approve on run_url computes the URL once, for start.jl and finish.jl. Co-Authored-By: Claude Sonnet 5.5 --- scripts/release/finish.jl | 3 +-- scripts/release/start.jl | 9 ++++++++- scripts/release/test/runtests.jl | 9 +++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/release/finish.jl b/scripts/release/finish.jl index 9e46241..b0b4514 100644 --- a/scripts/release/finish.jl +++ b/scripts/release/finish.jl @@ -342,8 +342,7 @@ function finish(repo::AbstractString; managers::AbstractString, act::Symbol=:ste requester = main = nothing r = f.pr.state == "OPEN" ? ready(repo, f.pr.number) : nothing end - run = haskey(ENV, "GITHUB_RUN_ID") ? - "$(get(ENV, "GITHUB_SERVER_URL", "https://github.com"))/$repo/actions/runs/$(ENV["GITHUB_RUN_ID"])" : "" + run = run_url(repo) # the bot refused the comment: the stop shows it, for a person to post handover = if p.phase == 7 && p.state === :blocked && get(f, :bot_error, nothing) !== nothing && live_mentions(f) == 0 body, target = registration_comment(repo, f, f.main_sha != f.pr.merge) diff --git a/scripts/release/start.jl b/scripts/release/start.jl index 90f58e1..cfd3bb5 100644 --- a/scripts/release/start.jl +++ b/scripts/release/start.jl @@ -96,6 +96,10 @@ function review_table(r) join(("| `$(x["id"])`: $(replace(get(x, "what", ""), "|" => "\\|")) | $(x["verdict"]) | $(replace(get(x, "note", ""), "|" => "\\|")) |" for x in rows), '\n') end +"The URL of the workflow run this process is in (`GITHUB_RUN_ID`), `\"\"` outside a run: where a person approves." +run_url(repo::AbstractString) = haskey(ENV, "GITHUB_RUN_ID") ? + "$(get(ENV, "GITHUB_SERVER_URL", "https://github.com"))/$repo/actions/runs/$(ENV["GITHUB_RUN_ID"])" : "" + """ open_issue(repo, dir, version; actor, managers, tries=12, pause=5) -> (Bool, String) @@ -139,12 +143,15 @@ function open_issue(repo::AbstractString, dir, version; actor, managers::Abstrac f = facts(repo; version=v) end f.issue === nothing && return (true, "opened #$n; GitHub does not list it yet: the next run posts the proposal") + run = run_url(repo) + approval = mode === :supervised ? + ", after an approval of the environment `release`" * (isempty(run) ? "" : " ([this run]($run), *Review deployments*)") : "" comment = """ **Phase 2 — Tracking issue.** Done: the tracking issue, from the request. Decisions: $(f.kind) `$v`, $mode, validated by `$(rel["requested_by"])`; started by `$actor`. Versions applied: ct-agents `$(r["versions"]["ct_agents"])`, ct-conventions `$(r["versions"]["ct_conventions"])`, CTActions `$(r["versions"]["ctactions"])`. Check: `release.jl request` → the request is complete (expected version, a verdict for every candidate). - Next: the release PR, once the CI of `main` is green on `$(rel["base"])`$(mode === :supervised ? ", after an approval of the environment `release`" : ""). + Next: the release PR, once the CI of `main` is green on `$(rel["base"])`$approval.
The proposal diff --git a/scripts/release/test/runtests.jl b/scripts/release/test/runtests.jl index c328df9..ad8de0a 100644 --- a/scripts/release/test/runtests.jl +++ b/scripts/release/test/runtests.jl @@ -1362,6 +1362,15 @@ failures(results) = [r.message for r in results if r.status === :fail] end end + @testset "the run to approve on (run_url)" begin + withenv("GITHUB_RUN_ID" => nothing) do + @test run_url("o/P") == "" + end + withenv("GITHUB_RUN_ID" => "42", "GITHUB_SERVER_URL" => nothing) do + @test run_url("o/P") == "https://github.com/o/P/actions/runs/42" + end + end + @testset "the release commit and the CI of main (phase 3)" begin dir = mktempdir() write(joinpath(dir, "Project.toml"), "name = \"P\"\nversion = \"0.8.17-beta\"\n\n[compat]\nversion = \"1\"\n")