From 88b95f6a95a1381ca567a49bf29fc526ef6f9925 Mon Sep 17 00:00:00 2001 From: tui-design Date: Tue, 17 Nov 2026 15:10:13 -0500 Subject: [PATCH] ci: log in with a write:package PAT called REGISTRY_TOKEN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Run 1364 got as far as building and naming the image, then every blob upload 401'd with 'unauthorized: reqPackageAccess'. Forgejo's container routes run reqPackageAccess(Write), which checks the login token's own scope list for write:package and rejects a scoped token without it — the token only has to be scoped, since an unscoped token skips the check. The repo's FORGEJO_TOKEN secret is such a scoped token. FORGEJO_/GITHUB_ are reserved secret prefixes, so that name cannot be created or updated through the API; the workflow now reads REGISTRY_TOKEN instead. --- .forgejo/workflows/build.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 50b63df..b51b488 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -144,12 +144,19 @@ jobs: run: | set -euo pipefail # GITHUB_TOKEN login "succeeds" but blob uploads 401 (Forgejo packages - # reject the Actions token). Use a user PAT with write:package. - if [ -z "${{ secrets.FORGEJO_TOKEN }}" ]; then - echo "Missing repo secret FORGEJO_TOKEN (user PAT, not GITHUB_TOKEN)" + # reject the Actions token). Use a user PAT. + # The PAT must carry the `write:package` scope: Forgejo mints a push + # token even without it and then rejects every blob upload with + # `unauthorized: reqPackageAccess` (routers/api/packages/api.go + # reqPackageAccess -> AccessTokenScopeWritePackage). + # Name is REGISTRY_TOKEN, not FORGEJO_TOKEN: Forgejo reserves the + # FORGEJO_/GITHUB_ prefixes and refuses to create or update them via + # the API. + if [ -z "${{ secrets.REGISTRY_TOKEN }}" ]; then + echo "Missing repo secret REGISTRY_TOKEN (user PAT with write:package, not GITHUB_TOKEN)" exit 1 fi - echo "${{ secrets.FORGEJO_TOKEN }}" | docker login "${{ steps.img.outputs.reg }}" \ + echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "${{ steps.img.outputs.reg }}" \ -u sirius --password-stdin - name: Build application image (api / ingester / cameras)