From 7e303e86df16ec4d8b419c9b589b48810792d4fa Mon Sep 17 00:00:00 2001 From: Yuki Iwai Date: Sun, 31 Aug 2025 05:23:11 +0900 Subject: [PATCH] Use 'on' in favor of 'if' for gh action workflows Signed-off-by: Yuki Iwai --- .github/workflows/golangci-lint.yml | 11 ++++++++--- .github/workflows/main.yml | 17 ++++++++++++----- .../mpi-operator-docker-image-publish.yml | 8 +++++--- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index ff49a11a5..dcad28700 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -1,11 +1,16 @@ name: golangci-lint on: push: - tags: - - v* branches: - - master + - "master" + - "release-*" + tags: + - "v*" pull_request: + branches: + - "master" + - "release-*" + jobs: golangci: name: lint diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 298c04d78..7984ac036 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,16 @@ name: build -on: [push, pull_request] +on: + push: + branches: + - "master" + - "release-*" + tags: + - "v*" + pull_request: + branches: + - "master" + - "release-*" + jobs: validate: name: Validate @@ -9,8 +20,6 @@ jobs: defaults: run: working-directory: ${{ env.GOPATH }}/src/github.com/kubeflow/mpi-operator - # Pull requests from the same repository won't trigger this checks as they were already triggered by the push - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository steps: - name: Clone the code uses: actions/checkout@v3 @@ -34,8 +43,6 @@ jobs: name: E2E runs-on: labels: ubuntu-latest-16-cores - # Pull requests from the same repository won't trigger this checks as they were already triggered by the push - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository strategy: fail-fast: false matrix: diff --git a/.github/workflows/mpi-operator-docker-image-publish.yml b/.github/workflows/mpi-operator-docker-image-publish.yml index b536dc447..5867c27b2 100644 --- a/.github/workflows/mpi-operator-docker-image-publish.yml +++ b/.github/workflows/mpi-operator-docker-image-publish.yml @@ -3,12 +3,14 @@ name: build and publish mpi multi-arch docker image on: push: branches: - - "master" + - "master" + - "release-*" tags: - - "v*" + - "v*" pull_request: branches: - - "master" + - "master" + - "release-*" env: IMAGE_NAME: mpioperator/mpi-operator