# Do not edit this file.
# This file is generated automatically by executing tox -e generate-workflows

name: CI

on:
  push:
    branches:
    - 'main'
  pull_request:
  merge_group:

permissions:
  contents: read

concurrency:
  group: ${% raw %}{{ github.workflow }}-${{ github.head_ref || github.run_id }}{% endraw %}
  cancel-in-progress: true

jobs:
  misc:
    uses: ./.github/workflows/misc.yml
  lint:
    uses: ./.github/workflows/lint.yml
  tests:
    uses: ./.github/workflows/test.yml
  contrib:
    uses: open-telemetry/opentelemetry-python-contrib/.github/workflows/core_contrib_test.yml@main
    with:
      CORE_REPO_SHA: ${% raw %}{{ github.sha }}{% endraw %}
      CONTRIB_REPO_SHA: {% raw %}${{ github.event_name == 'pull_request' && (
          contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref ||
          contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref ||
          'main'
        ) || 'main' }}{% endraw %}

  check:
    if: always()
    needs:
      - misc
      - lint
      - tests
      - contrib
    runs-on: ubuntu-latest
    steps:
      # Skip alls-green check for post-release version bumps in merge_group.
      # This avoids a deadlock where core and contrib repos wait for each other's releases.
      # See RELEASING.md for more details.
      - name: Decide whether the needed jobs succeeded or failed
        if: ${% raw %}{{ !(github.event_name == 'merge_group' && contains(github.event.merge_group.head_commit.message, 'Update version to')) }}{% endraw %}
        uses: re-actors/alls-green@release/v1
        with:
          jobs: ${% raw %}{{ toJSON(needs) }}{% endraw %}
