tweaks

c2956cc · gmorell · 2026-05-25 17:26

2 files +24 -1

Files changed

modified config/runtime.exs
+8 −0
@@ -143,6 +143,14 @@ if config_env() == :prod do
143 143 config :git_gud, GitGudWeb.PackagesWebhookController, shared_secret: zot_secret
144 144 end
145 145
146 + # Where forgejo-runner clones `uses: <owner>/<repo>@<ref>` action
147 + # references from. Default is code.forgejo.org (Forgejo's mirror of
148 + # common actions). Set to `https://github.com` to use GitHub
149 + # canonical, or to your own instance once you mirror them locally.
150 + if actions_url = System.get_env("GITGUD_DEFAULT_ACTIONS_URL") do
151 + config :git_gud, :default_actions_url, actions_url
152 + end
153 +
146 154 # The secret key base is used to sign/encrypt cookies and other secrets.
147 155 # A default value is used in config/dev.exs and config/test.exs but you
148 156 # want to use a different value for prod and you most likely don't want
modified lib/git_gud_web/controllers/runner_controller.ex
+16 −1
@@ -245,6 +245,14 @@ defmodule GitGudWeb.RunnerController do
245 245 defp build_context_struct(job, run, repo, token) do
246 246 base = GitGudWeb.Endpoint.url()
247 247
248 + # Where the runner resolves `uses: actions/checkout@v4` etc.
249 + # Default to code.forgejo.org which curates a mirror of the
250 + # common GitHub Actions. Override via:
251 + # config :git_gud, :default_actions_url, "https://github.com"
252 + # or env GITGUD_DEFAULT_ACTIONS_URL in runtime.exs.
253 + actions_url =
254 + Application.get_env(:git_gud, :default_actions_url, "https://code.forgejo.org")
255 +
248 256 %{
249 257 "event" => run.trigger || "push",
250 258 "ref" => run.head_ref || "",
@@ -258,7 +266,14 @@ defmodule GitGudWeb.RunnerController do
258 266 # equivalent used for artifact + cache API auth.
259 267 "token" => token,
260 268 "gitea_runtime_token" => token,
261 "gitea_default_actions_url" => base,
269 + # `gitea_default_actions_url` tells the runner where to clone
270 + # `uses: actions/<repo>@<ref>` from. If we point at our own
271 + # instance, the runner expects `actions/checkout` etc. to be
272 + # hosted here — which we don't do. Pointing at code.forgejo.org
273 + # makes references like `actions/checkout@v4` resolve to the
274 + # Forgejo-curated mirror; for GitHub-native references use
275 + # `https://github.com`.
276 + "gitea_default_actions_url" => actions_url,
262 277 "ACTIONS_RUNTIME_URL" => base <> "/api/actions/_apis/",
263 278 "ACTIONS_RUNTIME_TOKEN" => token,
264 279 "ACTIONS_CACHE_URL" => base <> "/api/actions/_apis/artifactcache/"

Parents: 8c74524