From f11b308f91da554c039ba9b6a03095d4d4f7d490 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Tue, 9 Jun 2026 20:43:25 -0400 Subject: [PATCH] fix(ci): use workflow_dispatch to trigger cinny-desktop build Replace the contents-API workaround with a direct workflow_dispatch call using ACTIONS_TOKEN (which has Actions:write scope). Cascade prevention in Gitea blocked all previous push-based approaches. The submodule bump is kept for correct SHA tracking in git history. Co-Authored-By: Claude Sonnet 4.6 --- .gitea/workflows/trigger-desktop.yml | 57 ++++++---------------------- 1 file changed, 12 insertions(+), 45 deletions(-) diff --git a/.gitea/workflows/trigger-desktop.yml b/.gitea/workflows/trigger-desktop.yml index 302cd1dca..74a8b836d 100644 --- a/.gitea/workflows/trigger-desktop.yml +++ b/.gitea/workflows/trigger-desktop.yml @@ -8,66 +8,33 @@ jobs: trigger: runs-on: ubuntu-latest steps: - - name: Bump cinny submodule and trigger cinny-desktop build + - name: Bump cinny submodule in cinny-desktop env: TOKEN: ${{ secrets.RELEASE_TOKEN }} run: | CINNY_SHA="${{ github.sha }}" - echo "New cinny SHA: $CINNY_SHA" - - # ── Step 1: check if cinny-desktop is already at this SHA ────────── - CURRENT=$(curl -sf \ - "https://code.lotusguild.org/api/v1/repos/LotusGuild/cinny-desktop/contents/.cinny-version" \ - -H "Authorization: token $TOKEN" 2>/dev/null || echo "{}") - CURRENT_SHA=$(echo "$CURRENT" | python3 -c \ - "import sys,json,base64; d=json.load(sys.stdin); \ - print(base64.b64decode(d['content']).decode().strip() if 'content' in d else '')" \ - 2>/dev/null || echo "") - - if [ "$CURRENT_SHA" = "$CINNY_SHA" ]; then - echo "cinny-desktop already at $CINNY_SHA — nothing to do" - exit 0 - fi - - # ── Step 2: bump the git submodule pointer ────────────────────────── git clone "https://x-access-token:$TOKEN@code.lotusguild.org/LotusGuild/cinny-desktop.git" desktop cd desktop git config user.email "ci@lotusguild.org" git config user.name "Lotus CI" - git submodule update --init cinny git -C cinny fetch origin git -C cinny checkout "$CINNY_SHA" - git add cinny if git diff --cached --quiet; then - echo "Submodule pointer already correct" + echo "Submodule already at $CINNY_SHA" else git commit -m "chore: bump cinny submodule to ${CINNY_SHA:0:8}" git push origin main - echo "Submodule bump pushed" fi - cd .. - # ── Step 3: update .cinny-version via Gitea contents API ──────────── - # Actions-runner pushes don't trigger downstream workflows in Gitea. - # A REST API file update creates a real user-attributed commit that does. - FILE_SHA=$(echo "$CURRENT" | python3 -c \ - "import sys,json; d=json.load(sys.stdin); print(d.get('sha',''))" \ - 2>/dev/null || echo "") - CONTENT=$(echo -n "$CINNY_SHA" | base64 -w 0) - - if [ -n "$FILE_SHA" ]; then - curl -sf -X PUT \ - "https://code.lotusguild.org/api/v1/repos/LotusGuild/cinny-desktop/contents/.cinny-version" \ - -H "Authorization: token $TOKEN" \ - -H "Content-Type: application/json" \ - -d "{\"message\":\"chore: trigger desktop build for cinny ${CINNY_SHA:0:8}\",\"content\":\"$CONTENT\",\"sha\":\"$FILE_SHA\"}" - else - curl -sf -X POST \ - "https://code.lotusguild.org/api/v1/repos/LotusGuild/cinny-desktop/contents/.cinny-version" \ - -H "Authorization: token $TOKEN" \ - -H "Content-Type: application/json" \ - -d "{\"message\":\"chore: trigger desktop build for cinny ${CINNY_SHA:0:8}\",\"content\":\"$CONTENT\"}" - fi - echo "release.yml triggered via API commit" + - name: Dispatch cinny-desktop release build + env: + TOKEN: ${{ secrets.ACTIONS_TOKEN }} + run: | + curl -sf -X POST \ + "https://code.lotusguild.org/api/v1/repos/LotusGuild/cinny-desktop/actions/workflows/release.yml/dispatches" \ + -H "Authorization: token $TOKEN" \ + -H "Content-Type: application/json" \ + -d '{"ref":"main"}' + echo "Dispatched release.yml on cinny-desktop/main"