From 51f5c80d8708bbac7aaf280c0382d367e2d22f43 Mon Sep 17 00:00:00 2001 From: Tyler Perkins Date: Sun, 15 Nov 2026 18:21:51 -0500 Subject: [PATCH] Fix registry login: secrets are not environment variables The first pipeline run failed at the login step with "no registry token available". `secrets.*` values only exist when named with an expression, so `${GITHUB_TOKEN}` in the shell was always empty; both candidate tokens are now mapped into the step's environment and the shell chooses between them. The rest of the run was healthy: docker was available to the job and the test stage passed inside it (Ran 276 tests ... OK). --- .gitea/workflows/build.yaml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index e78778c..eff8203 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -132,12 +132,23 @@ jobs: # to publish an image into this registry. - name: Log in to the registry if: github.event_name != 'pull_request' + # Secrets are not environment variables -- they only exist when named + # with an expression, which is what this block is for. The fallback + # lives in the shell rather than in a `||` expression so that it does + # not depend on the evaluator supporting either. + env: + TOKEN_FROM_SECRET: ${{ secrets.REGISTRY_TOKEN }} + TOKEN_FROM_GITEA: ${{ secrets.GITHUB_TOKEN }} run: | set -eu - token="${REGISTRY_TOKEN:-${GITHUB_TOKEN:-}}" + token="${TOKEN_FROM_SECRET:-}" if [ -z "$token" ]; then - echo "::error::no registry token available; set a" - echo "REGISTRY_TOKEN secret (scope: write:package)" + token="${TOKEN_FROM_GITEA:-}" + fi + if [ -z "$token" ]; then + echo "::error::no registry token available. Gitea's automatic" + echo "token is normally enough; if a push is refused, create a" + echo "PAT with the write:package scope as REGISTRY_TOKEN." exit 1 fi printf '%s' "$token" |