From 2286f71dd5ad8bffe24168b06ddd92f84209958c Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Mon, 18 Aug 2025 12:28:56 +0200 Subject: [PATCH] chore: cascade forgejo pull request out of the runner branch or PR (followup) The SHA must be reachable from a branch or tags to be discovered by go mod tidy. --- .forgejo/cascading-forgejo | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.forgejo/cascading-forgejo b/.forgejo/cascading-forgejo index a85a53b0..7c305127 100755 --- a/.forgejo/cascading-forgejo +++ b/.forgejo/cascading-forgejo @@ -29,6 +29,15 @@ cd $forgejo # find * -name '*.go' -o -name 'go.mod' | xargs sed -i -E -e "s|code.forgejo.org/forgejo/runner/v[0-9]+|$module|" # +# If it is a pull request, change the module to reference the forked repository so +# go mod tidy can find the SHA from a known branch or tag +# +if test -f "$runner_pr_or_ref"; then + repository=$(jq --raw-output .head.repo.full_name <$runner_pr_or_ref) + test "$repository" + module=$(echo $module | sed -e "s|code.forgejo.org/forgejo/runner|code.forgejo.org/$repository|") +fi +# # add a "replace code.forgejo.org/forgejo/runner/v?? $sha" line to the forgejo go.mod # so that it uses the branch or pull request from which the cascade is run. #