[ci skip] Improve build workflow conditions (#11842)

The goal of the build workflow is split into multiple requirements.
  1. Run on pushes to same repo.
  2. Run on PR open/reopen/syncs from repos that are not the same
     (PRs from the same repo are covered by 1)
  3. Run on labeled PRs that have the build-pr-jar flag.
This commit is contained in:
Bjarne Koll 2024-12-27 22:43:08 +01:00 committed by GitHub
parent ca8709b30f
commit e10dcbf7ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,8 +16,17 @@ on:
jobs: jobs:
build: build:
# Run on all label events (won't be duplicated) or all push events or on PR syncs not from the same repo # The goal of the build workflow is split into multiple requirements.
if: (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'build-pr-jar') || github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name # 1. Run on pushes to same repo.
# 2. Run on PR open/reopen/syncs from repos that are not the same (PRs from the same repo are covered by 1)
# 3. Run on labeled PRs that have the build-pr-jar flag.
if: >
(
(github.event_name == 'push')
|| (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name && contains(fromJSON('["opened", "reopened", "synchronize"]'), github.event.action))
|| (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'build-pr-jar')
)
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix: