[llvm] [GitHub][CI] Add clang-tidy premerge workflow (PR #154829)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 23 12:16:33 PDT 2025


================
@@ -0,0 +1,126 @@
+name: "Code lint"
+
+permissions:
+  contents: read
+
+on:
+  pull_request:
+    branches:
+      - main
+      - 'users/**'
+    paths:
+      - 'clang-tools-extra/clang-tidy/**'
+
+jobs:
+  code_linter:
+    if: github.repository_owner == 'llvm'
+    runs-on: ubuntu-24.04
+    defaults:
+      run:
+        shell: bash
+    container:
+      image: 'ghcr.io/llvm/ci-ubuntu-24.04:latest'
+    timeout-minutes: 60
+    concurrency:
+      group: ${{ github.workflow }}-${{ github.ref }}
+      cancel-in-progress: true
+    steps:
+      - name: Fetch LLVM sources
+        uses: actions/checkout at b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
+        with:
+          fetch-depth: 2
+      
+      - name: Get changed files
+        id: changed-files
+        uses: step-security/changed-files at 3dbe17c78367e7d60f00d78ae6781a35be47b4a1 # v45.0.1
+        with:
+          separator: ","
+          skip_initial_fetch: true
+          base_sha: 'HEAD~1'
+          sha: 'HEAD'
+      
+      - name: Listed files
+        env:
+          CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
+        run: |
+          echo "Changed files:"
+          echo "$CHANGED_FILES"
+      
+      - name: Fetch code linting utils
+        uses: actions/checkout at 08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+        with:
+          repository: ${{ github.repository }}
+          ref: ${{ github.base_ref }}
+          sparse-checkout: |
+            llvm/utils/git/code-lint-helper.py
+            llvm/utils/git/requirements_linting.txt
+            clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
+          sparse-checkout-cone-mode: false
+          path: code-lint-tools
+      
+      - uses: actions/setup-python at v5
----------------
boomanaiden154 wrote:

This should be hash pinned.

https://github.com/llvm/llvm-project/pull/154829


More information about the llvm-commits mailing list