name: PR build

concurrency: 
  group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
  cancel-in-progress: true

on:
  pull_request:

jobs:
  build:
    uses: ./.github/workflows/build.yml
    if: github.repository == 'blue-build/cli'
    permissions:
      contents: read
      packages: write
      id-token: write
    with:
      repo: ${{ github.event.pull_request.head.repo.full_name }}
      ref: ${{ github.event.pull_request.head.ref }}
    secrets: inherit
  test:
    uses: ./.github/workflows/test.yml
    permissions:
      contents: read
      packages: write
      id-token: write
    with:
      repo: ${{ github.event.pull_request.head.repo.full_name }}
      ref: ${{ github.event.pull_request.head.ref }}
      pr_event_number: ${{ github.event.number }}
    secrets: inherit
