# Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0

name: Optional_Clang_Tidy_Review

on:
  pull_request:
    branches: [ "main", rel-* ]
    paths:
      - "**.cc"
      - "**.h"
  workflow_dispatch:

permissions:  # set top-level default permissions as security best practice
  contents: read

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'workflow_dispatch' }}
  cancel-in-progress: true

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
      # Pleaes note that it won't cause any failure here; it will only post comments in PRs
      - name: clang-tidy review
        uses: ZedThree/clang-tidy-review@85799d63d217e8d0686b7735fb923acc986d8043 # v0.19.0
        with:
          apt_packages: "libprotobuf-dev,protobuf-compiler"
          cmake_command: "cmake -S . -B .setuptools-cmake-build -DCMAKE_EXPORT_COMPILE_COMMANDS=on -DONNX_USE_PROTOBUF_SHARED_LIBS=ON"
          build_dir: ".setuptools-cmake-build"
          exclude: "/third_party/*"
          split_workflow: true
      - uses: ZedThree/clang-tidy-review/upload@85799d63d217e8d0686b7735fb923acc986d8043 # v0.19.0
