Make clang tidy action work in PRs from forks using split_workflow

This commit is contained in:
David Capello 2024-02-27 19:07:53 -03:00
parent 619b5cbada
commit 8fc7592066
2 changed files with 25 additions and 5 deletions

View File

@ -5,6 +5,10 @@ on:
- '**.cpp' - '**.cpp'
- '**.h' - '**.h'
- '.github/workflows/clang_tidy.yml' - '.github/workflows/clang_tidy.yml'
permissions:
contents: read
jobs: jobs:
review: review:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -12,19 +16,17 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: 'recursive' submodules: 'recursive'
- uses: ZedThree/clang-tidy-review@v0.17.1 - uses: ZedThree/clang-tidy-review@v0.14.0
id: review id: review
with: with:
token: ${{ secrets.CLANG_TIDY_TOKEN }}
build_dir: build build_dir: build
config_file: .clang-tidy config_file: .clang-tidy
split_workflow: true
apt_packages: | apt_packages: |
libc++-dev, libc++abi-dev, libpixman-1-dev, libc++-dev, libc++abi-dev, libpixman-1-dev,
libfreetype6-dev, libharfbuzz-dev, zlib1g-dev, libx11-dev, libfreetype6-dev, libharfbuzz-dev, zlib1g-dev, libx11-dev,
libxcursor-dev, libxi-dev, libgl1-mesa-dev libxcursor-dev, libxi-dev, libgl1-mesa-dev
cmake_command: | cmake_command: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DLAF_BACKEND=none -DCMAKE_EXPORT_COMPILE_COMMANDS=on cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DLAF_BACKEND=none -DCMAKE_EXPORT_COMPILE_COMMANDS=on
- uses: ZedThree/clang-tidy-review/upload@v0.17.1 - uses: ZedThree/clang-tidy-review/upload@v0.14.0
id: upload-review id: upload-review
- if: steps.review.outputs.total_comments > 0
run: exit 1

18
.github/workflows/clang_tidy_post.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Post Clang Tidy Comments
on:
workflow_run:
workflows: ["Clang Tidy Diff"]
types:
- completed
permissions:
checks: write
pull-requests: write
jobs:
post-comments:
runs-on: ubuntu-latest
steps:
- uses: ZedThree/clang-tidy-review/post@v0.14.0
with:
token: ${{ secrets.CLANG_TIDY_TOKEN }}