[llvm] [Github] Add CodeQL Action to check Github Actions Workflows (PR #158394)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 12 18:22:21 PDT 2025


https://github.com/boomanaiden154 updated https://github.com/llvm/llvm-project/pull/158394

>From a91a861fe95bfae453c04b710feb4bdf40122bc0 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Sat, 13 Sep 2025 01:15:26 +0000
Subject: [PATCH 1/3] [Github] Add CodeQL Action to check Github Actions
 Workflows

This should point out obvious security issues with our Github Actions
workflows.
---
 .github/workflows/gha-codeql.yml | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 .github/workflows/gha-codeql.yml

diff --git a/.github/workflows/gha-codeql.yml b/.github/workflows/gha-codeql.yml
new file mode 100644
index 0000000000000..87f1a5787b7a6
--- /dev/null
+++ b/.github/workflows/gha-codeql.yml
@@ -0,0 +1,30 @@
+name: Github Actions CodeQL
+
+permissions:
+  contents: read
+
+on:
+  pull_request:
+    branches:
+      - main
+
+concurrency:
+  group: ${{ github.workflow }}
+  cancel-in-progress: true
+
+jobs:
+  codeql:
+    name: 'Github Actions CodeQL'
+    runs-on: ubuntu-24.04
+    permissions:
+      security-events: write
+    steps:
+      - name: Checkout LLVM
+        uses: actions/checkout at 08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+      - name: Initialize CodeQL
+        uses: github/codeql-action/init at 192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3
+        with:
+          languages: actions
+          queries: security-extended
+      - name: Perform CodeQL Analysis
+        uses: github/codeql-action/analyze at 192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3

>From ca390c4f2d02a6409b3c5dcd4669b45f0a51a949 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Sat, 13 Sep 2025 01:20:35 +0000
Subject: [PATCH 2/3] Change checkout

---
 .github/workflows/gha-codeql.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.github/workflows/gha-codeql.yml b/.github/workflows/gha-codeql.yml
index 87f1a5787b7a6..568277315d205 100644
--- a/.github/workflows/gha-codeql.yml
+++ b/.github/workflows/gha-codeql.yml
@@ -21,6 +21,8 @@ jobs:
     steps:
       - name: Checkout LLVM
         uses: actions/checkout at 08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+        sparse-checkout: |
+          .github/
       - name: Initialize CodeQL
         uses: github/codeql-action/init at 192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3
         with:

>From ff779b963ab069f2d6f5361b56d27929488f0e22 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Sat, 13 Sep 2025 01:22:09 +0000
Subject: [PATCH 3/3] fix thing

---
 .github/workflows/gha-codeql.yml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/gha-codeql.yml b/.github/workflows/gha-codeql.yml
index 568277315d205..aadd607fc8ea1 100644
--- a/.github/workflows/gha-codeql.yml
+++ b/.github/workflows/gha-codeql.yml
@@ -21,8 +21,9 @@ jobs:
     steps:
       - name: Checkout LLVM
         uses: actions/checkout at 08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
-        sparse-checkout: |
-          .github/
+        with:
+          sparse-checkout: |
+            .github/
       - name: Initialize CodeQL
         uses: github/codeql-action/init at 192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3
         with:



More information about the llvm-commits mailing list