From 00047c95b83b1d6aa7339f57a51c2ba9273e9ca5 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Mon, 2 Mar 2026 14:37:50 +0100 Subject: [PATCH] Add workflow to push json changes to pocketbase --- .github/workflows/push-json-to-pocketbase.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push-json-to-pocketbase.yml b/.github/workflows/push-json-to-pocketbase.yml index c21744104..dbfa148ef 100644 --- a/.github/workflows/push-json-to-pocketbase.yml +++ b/.github/workflows/push-json-to-pocketbase.yml @@ -74,7 +74,8 @@ jobs: req.end(); }); } - const base = process.env.POCKETBASE_URL.replace(/\/$/, '') + '/api'; + const raw = process.env.POCKETBASE_URL.replace(/\/$/, ''); + const base = /\/api$/i.test(raw) ? raw : raw + '/api'; const coll = process.env.POCKETBASE_COLLECTION; const files = fs.readFileSync('changed_app_jsons.txt', 'utf8').trim().split(/\s+/).filter(Boolean); const authRes = await request(base + '/admins/auth-with-password', { @@ -85,7 +86,7 @@ jobs: password: process.env.POCKETBASE_ADMIN_PASSWORD }) }); - if (!authRes.ok) throw new Error('Auth failed: ' + authRes.body); + if (!authRes.ok) throw new Error('Auth failed (check POCKETBASE_URL; use base URL without /api): ' + authRes.body); const token = JSON.parse(authRes.body).token; const recordsPath = '/api/collections/' + encodeURIComponent(coll) + '/records'; const recordsUrl = base.replace(/\/api$/, '') + recordsPath;