name: Stylecheck

on:
  pull_request:
  push:
    branches:
      - nightly
      - main
      - release/*
  workflow_dispatch:

jobs:
  python-source-and-configs:
    uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
    with:
      repository: pytorch/audio
      docker-image: "pytorch/torchaudio_unittest_base:manylinux"
      script: |
        set -euo pipefail

        # Set CHANNEL
        if [[(${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
          export UPLOAD_CHANNEL=test
        else
          export UPLOAD_CHANNEL=nightly
        fi

        .circleci/unittest/linux/scripts/setup_env.sh
        .circleci/unittest/linux/scripts/run_style_checks.sh
