# Test Builds pack from pushes and pull requests in same repo.
name: "[NOT CALLABLE] Test Build Pack"
on:
  push:
    branches:
      - main
      - test-buildscript*
      - dev/*
    paths-ignore:
      - "README.md"

  pull_request:
    paths-ignore:
      - "README.md"
    types:
      - opened
      - reopened
      - synchronize

# if a second commit is pushed quickly after the first, cancel the first one's build
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build:
    # Only allow runs from commits to Nomi-CEu Branches or from pull requests from Nomi-CEu repo without dev/ (That is handled by push)
    if: "${{ github.repository_owner == 'Nomi-CEu' && ( !github.event.pull_request || ( github.event.pull_request.head.repo.owner.login == 'Nomi-CEu' && !startsWith(github.head_ref, 'dev/') ) ) }}"
    name: Test Build Pack
    uses: ./.github/workflows/buildpack.yml
    with:
      separate_upload: true
      head_ref: ${{ github.head_ref }}
      true_sha: ${{ github.event.pull_request.head.sha }}
      skip_changelog: ${{ github.event.pull_request != null }}
    secrets: inherit
