Skip to content

Commit 40b0ec0

Browse files
committed
fix: skip registry login on forks
1 parent 056c412 commit 40b0ec0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ jobs:
1818
runs-on: ubuntu-latest
1919
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') || github.event_name == 'pull_request'
2020

21+
env:
22+
PUSH_IMAGE: ${{ github.repository == 'EOPF-Explorer/data-pipeline' && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
23+
2124
steps:
2225
- name: Checkout code
2326
uses: actions/checkout@v5
@@ -38,6 +41,7 @@ jobs:
3841
uses: docker/setup-buildx-action@v3
3942

4043
- name: Log in to OVH Container Registry
44+
if: env.PUSH_IMAGE == 'true'
4145
uses: docker/login-action@v3
4246
with:
4347
registry: ${{ secrets.OVH_HARBOR_REGISTRY }}
@@ -50,7 +54,7 @@ jobs:
5054
context: .
5155
file: docker/Dockerfile
5256
platforms: linux/amd64
53-
push: true
57+
push: ${{ env.PUSH_IMAGE == 'true' }}
5458
tags: ${{ steps.meta.outputs.tags }}
5559
labels: ${{ steps.meta.outputs.labels }}
5660
cache-from: type=gha

0 commit comments

Comments
 (0)