From 610a1d673b7e1e209f16902922cb456b106d28be Mon Sep 17 00:00:00 2001
From: jo <ljonas@riseup.net>
Date: Wed, 1 Sep 2021 16:55:26 +0200
Subject: [PATCH] Fix CI docker test image

- Lowercase registry organisation name
- Always use LibreTime's org dev image for tests
- Never build the dev image on forks
---
 .github/workflows/test.yml  |  2 +-
 .github/workflows/tools.yml | 14 +++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 5bdeb93c2..34be5f7cc 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -96,7 +96,7 @@ jobs:
         release: [bionic, buster]
         context: [python_apps/airtime_analyzer, python_apps/api_clients]
 
-    container: ghcr.io/${{ github.repository_owner }}/libretime-dev:${{ matrix.release }}
+    container: ghcr.io/libretime/libretime-dev:${{ matrix.release }}
     defaults:
       run:
         shell: bash
diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml
index d2d37fb3d..44f1f97a3 100644
--- a/.github/workflows/tools.yml
+++ b/.github/workflows/tools.yml
@@ -20,14 +20,22 @@ jobs:
           - distribution: debian
             release: buster
 
+    env:
+      REGISTRY: ghcr.io
+      IMAGE_ORG: libretime
+      IMAGE_NAME: libretime-dev
+
+    # See https://github.com/LibreTime/libretime/issues/1216
+    # See https://github.com/LibreTime/libretime/actions/runs/1190504235
+    if: ${{ github.repository_owner == 'LibreTime' }}
     steps:
       - name: Checkout
         uses: actions/checkout@v2
 
-      - name: Login to DockerHub
+      - name: Login to the Container registry
         uses: docker/login-action@v1
         with:
-          registry: ghcr.io
+          registry: ${{ env.REGISTRY }}
           username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
 
@@ -74,4 +82,4 @@ jobs:
         with:
           context: .
           push: true
-          tags: ghcr.io/${{ github.repository_owner }}/libretime-dev:${{ matrix.release }}
+          tags: ${{ env.REGISTRY }}/${{ env.IMAGE_ORG }}/${{ env.IMAGE_NAME }}:${{ matrix.release }}