Skip to content

Commit

Permalink
Limit push builds to the main branch (#1730)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
neilvcarvalho authored Jan 31, 2025
1 parent afd6d25 commit a2df3a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit a2df3a3

Please sign in to comment.