ci: allow pushing of containers during pull requests
authorPetr Štetiar <ynezz@true.cz>
Mon, 15 May 2023 07:25:07 +0000 (09:25 +0200)
committerPetr Štetiar <ynezz@true.cz>
Mon, 15 May 2023 15:36:01 +0000 (17:36 +0200)
Make it possible to push containers in pull requests in private forks,
so the container can be actually runtime tested before merging the
changes.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
.github/workflows/build-push.yml

index 451fc871d38c1b5ce289a433478dd49e82695800..666c9e39d6fab4dcafe6d4d11f3928485c210299 100644 (file)
@@ -65,14 +65,14 @@ jobs:
 
       - name: Docker meta
         id: meta
-        if: github.event_name != 'pull_request'
+        if: github.event_name != 'pull_request' || github.repository_owner != 'openwrt'
         uses: docker/metadata-action@v4
         with:
           images: name=ghcr.io/${{ github.repository }}/build${{ matrix.container_flavor }}-v${{ env.BUILDBOT_VERSION }}
 
       - name: Login to GitHub Container Registry
         uses: docker/login-action@v2
-        if: github.event_name != 'pull_request'
+        if: github.event_name != 'pull_request' || github.repository_owner != 'openwrt'
         with:
           registry: ghcr.io
           username: ${{ github.actor }}
@@ -80,7 +80,7 @@ jobs:
 
       - name: Build container again and push it
         uses: docker/build-push-action@v4
-        if: github.event_name != 'pull_request'
+        if: github.event_name != 'pull_request' || github.repository_owner != 'openwrt'
         with:
           push: true
           tags: ${{ steps.meta.outputs.tags }}