From 7c8fe9fefbe9df6b0facffd98bde77da772b3f56 Mon Sep 17 00:00:00 2001 From: Neil Carvalho Date: Fri, 31 Jan 2025 13:41:57 -0300 Subject: [PATCH] Limit `push` builds to the `main` branch GitHub Actions has been running the lint twice in Pull Requests: once following the `on push` trigger, once following `on pull_request`. This duplication is currently avoided when running tests by an `if` rule, which skips if the event isn't a push or the Pull Request doesn't come from a fork. This commit removes the `if` rule, and limits the `push` builds to the `main` branch. That will ensure that merged Pull Requests will trigger a build, and that any Pull Request activity will also trigger a build. Being a global rule for the whole build, `standard` will not run twice anymore. --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a1931bda..772b6611 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,12 +1,12 @@ name: Build on: - - push - - pull_request + pull_request: + push: + branches: [ main ] jobs: build: name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }} - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository strategy: fail-fast: false matrix: