From 8630bfc63085182bb46cebe3b358a31a55b7ee8e Mon Sep 17 00:00:00 2001 From: Eguzki Astiz Lezaun Date: Tue, 30 Apr 2024 18:42:52 +0200 Subject: [PATCH] fixup! forks do not have permissions to push images --- .github/workflows/build-image.yaml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml index fe594328..860df488 100644 --- a/.github/workflows/build-image.yaml +++ b/.github/workflows/build-image.yaml @@ -15,7 +15,11 @@ env: jobs: build: name: Build - if: github.event.pull_request.head.repo.full_name == github.repository + # for tags and not forks + if: | + (startsWith(github.ref, 'refs/tags/')) || + (!startsWith(github.ref, 'refs/tags/') && + github.event.pull_request.head.repo.full_name == github.repository) runs-on: ubuntu-latest strategy: fail-fast: false @@ -73,7 +77,11 @@ jobs: retention-days: 1 merge: runs-on: ubuntu-latest - if: github.event.pull_request.head.repo.full_name == github.repository + # for tags and not forks + if: | + (startsWith(github.ref, 'refs/tags/')) || + (!startsWith(github.ref, 'refs/tags/') && + github.event.pull_request.head.repo.full_name == github.repository) needs: - build steps: @@ -115,8 +123,10 @@ jobs: run: | docker run --rm -t ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/limitador:${{ steps.meta.outputs.version }} limitador-server --help build-from-forks: - name: Build - if: github.event.pull_request.head.repo.full_name != github.repository + name: Build on forks + if: | + !startsWith(github.ref, 'refs/tags/') && + github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: - name: Check out code