name: GHA for {{ namespace }}.{{ collection_name }}
{% raw %}
concurrency:
  group: ${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

on:  # yamllint disable-line rule:truthy
  pull_request:
    branches: [main]
  workflow_dispatch:
  schedule:
    - cron: '0 0 * * *'

jobs:
  ansible-lint:
    uses: ansible-network/github_actions/.github/workflows/ansible-lint.yml@main
  changelog:
    uses: ansible-network/github_actions/.github/workflows/changelog.yml@main
  integration:
    uses: ansible-network/github_actions/.github/workflows/integration_simple.yml@main
  sanity:
    uses: ansible-network/github_actions/.github/workflows/sanity.yml@main
  unit-galaxy:
    uses: ansible-network/github_actions/.github/workflows/unit_galaxy.yml@main

  all_green:
    if: ${{ always() && (github.event_name != 'schedule') }}
    needs:
      - changelog
      - integration
      - sanity
      - unit-galaxy
    runs-on: ubuntu-latest
    steps:
      - run: >-
          python -c "assert set([
          '${{ needs.changelog.result }}',
          '${{ needs.integration.result }}',
          '${{ needs.sanity.result }}',
          '${{ needs.unit-galaxy.result }}'
          ]) == {'success'}"
{% endraw %}
