name: Android CI (Merge Queue)

on:
  merge_group:
    types: [checks_requested]

permissions:
  contents: read

concurrency:
  group: build-mq-${{ github.ref }}
  cancel-in-progress: true

jobs:
  android-check:
    if: github.repository == 'meshtastic/Meshtastic-Android'
    uses: ./.github/workflows/reusable-check.yml
    with:
      run_lint: true
      run_unit_tests: true
      upload_artifacts: false
    secrets: inherit

  check-workflow-status:
    name: Check Workflow Status
    runs-on: ubuntu-24.04-arm
    permissions: {}
    needs:
      - android-check
    if: always()
    steps:
      - name: Check Workflow Status
        run: |
          if [[ "${{ needs.android-check.result }}" == "failure" || "${{ needs.android-check.result }}" == "cancelled" ]]; then
            echo "::error::Android Check failed"
            exit 1
          fi
          echo "All jobs passed successfully"
