From ea6eece9476c741683b1eaddd38498bfd43f61c7 Mon Sep 17 00:00:00 2001 From: muhammad adil ghaffar Date: Mon, 11 Mar 2024 12:52:25 +0200 Subject: [PATCH] Making workflows not run on forks. Signed-off-by: muhammad adil ghaffar --- .github/workflows/buildtest.yml | 4 ++-- .github/workflows/image-push-master.yml | 5 +++++ .github/workflows/image-push-release.yml | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildtest.yml b/.github/workflows/buildtest.yml index 30b93e483..b77e8510b 100644 --- a/.github/workflows/buildtest.yml +++ b/.github/workflows/buildtest.yml @@ -50,7 +50,7 @@ jobs: - name: Go test with coverage run: sudo make test-coverage # sudo needed for netns change in test - + - name: Coveralls uses: coverallsapp/github-action@v2 with: @@ -69,7 +69,7 @@ jobs: - name: build sriov-cni image run: podman build -t ghaction-sriov-cni:pr-${{github.event.pull_request.number}} . - + - name: Check out sriov operator's code uses: actions/checkout@v2 with: diff --git a/.github/workflows/image-push-master.yml b/.github/workflows/image-push-master.yml index 0e01babc1..f59694331 100644 --- a/.github/workflows/image-push-master.yml +++ b/.github/workflows/image-push-master.yml @@ -2,6 +2,7 @@ name: "Push images on merge to master" env: IMAGE_NAME: ghcr.io/${{ github.repository }} + image-push-owner: 'k8snetworkplumbingwg' on: push: @@ -9,6 +10,7 @@ on: - master jobs: build-and-push-amd64-sriov-cni: + if: ${{ github.repository_owner == env.image-push-owner }} name: Image Push AMD64 runs-on: ubuntu-20.04 steps: @@ -37,6 +39,7 @@ jobs: file: ./Dockerfile build-and-push-arm64-sriov-cni: + if: ${{ github.repository_owner == env.image-push-owner }} name: Image Push ARM64 runs-on: ubuntu-20.04 steps: @@ -67,6 +70,7 @@ jobs: file: ./Dockerfile.arm64 build-and-push-ppc64le-sriov-cni: + if: ${{ github.repository_owner == env.image-push-owner }} name: Image Push ppc64le runs-on: ubuntu-20.04 steps: @@ -97,6 +101,7 @@ jobs: file: ./Dockerfile.ppc64le push-manifest: + if: ${{ github.repository_owner == env.image-push-owner }} runs-on: ubuntu-20.04 needs: [build-and-push-amd64-sriov-cni,build-and-push-arm64-sriov-cni,build-and-push-ppc64le-sriov-cni] steps: diff --git a/.github/workflows/image-push-release.yml b/.github/workflows/image-push-release.yml index 116c75159..80377ad1f 100644 --- a/.github/workflows/image-push-release.yml +++ b/.github/workflows/image-push-release.yml @@ -2,6 +2,7 @@ name: "Push images on release" env: IMAGE_NAME: ghcr.io/${{ github.repository }} + image-push-owner: 'k8snetworkplumbingwg' on: push: @@ -9,6 +10,7 @@ on: - v* jobs: build-and-push-amd64-sriov-cni: + if: ${{ github.repository_owner == env.image-push-owner }} runs-on: ubuntu-20.04 name: Image push AMD64 steps: @@ -46,6 +48,7 @@ jobs: file: ./Dockerfile build-and-push-arm64-sriov-cni: + if: ${{ github.repository_owner == env.image-push-owner }} runs-on: ubuntu-20.04 name: Image push ARM64 steps: @@ -83,6 +86,7 @@ jobs: file: ./Dockerfile.arm64 build-and-push-ppc64le-sriov-cni: + if: ${{ github.repository_owner == env.image-push-owner }} runs-on: ubuntu-20.04 name: Image push ppc64le steps: @@ -120,6 +124,7 @@ jobs: file: ./Dockerfile.ppc64le push-manifest: + if: ${{ github.repository_owner == env.image-push-owner }} runs-on: ubuntu-20.04 needs: [build-and-push-amd64-sriov-cni,build-and-push-arm64-sriov-cni,build-and-push-ppc64le-sriov-cni] steps: