forked from OpenLineage/OpenLineage
-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (86 loc) · 3.64 KB
/
codeql.yml
File metadata and controls
104 lines (86 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Copyright 2018-2026 contributors to the OpenLineage project
# SPDX-License-Identifier: Apache-2.0
#
# Overrides GitHub Default Setup with a dynamic language matrix: only languages
# that have source files in the repository are scanned. This prevents false
# failures when CodeQL is configured for a language (e.g. Go) that has no
# corresponding source code.
name: "CodeQL"
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
schedule:
- cron: "30 1 * * 0"
permissions:
contents: read
# Cancel any in-progress run for the same ref to avoid concurrent SARIF uploads
# conflicting with each other or with GitHub's Default Setup.
concurrency:
group: codeql-${{ github.ref }}
cancel-in-progress: true
jobs:
detect-languages:
name: Detect languages
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.detect.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- name: Detect CodeQL-supported languages present in repo
id: detect
shell: bash
run: |
includes=()
# GitHub Actions workflows (always present if the .github/workflows dir exists)
actions_files=$(find .github/workflows -name '*.yml' -print -quit 2>/dev/null)
[ -n "$actions_files" ] && includes+=('{"language":"actions","build-mode":"none"}')
# Go — excluded: CodeQL's autobuild fails to extract Go source code for
# this project ("no Go source code written") regardless of whether
# client/go/ is present. Re-enable once the Go module is compatible
# with CodeQL autobuild (see GitHub's troubleshooting guide for details).
# go_files=$(find . -not -path './.git/*' -name '*.go' -print -quit 2>/dev/null)
# [ -n "$go_files" ] && includes+=('{"language":"go","build-mode":"autobuild"}')
# Java/Kotlin — excluded: autobuild cannot handle OpenLineage's Gradle project
# without custom build steps. Add manual build steps here if Java scanning
# is needed in the future.
py_files=$(find . -not -path './.git/*' -name '*.py' -print -quit 2>/dev/null)
[ -n "$py_files" ] && includes+=('{"language":"python","build-mode":"none"}')
js_files=$(find . -not -path './.git/*' \( -name '*.js' -o -name '*.ts' \) -print -quit 2>/dev/null)
[ -n "$js_files" ] && includes+=('{"language":"javascript-typescript","build-mode":"none"}')
rb_files=$(find . -not -path './.git/*' -name '*.rb' -print -quit 2>/dev/null)
[ -n "$rb_files" ] && includes+=('{"language":"ruby","build-mode":"none"}')
matrix='{"include":['
for i in "${!includes[@]}"; do
[ "$i" -gt 0 ] && matrix+=','
matrix+="${includes[$i]}"
done
matrix+=']}'
echo "Detected languages: $matrix"
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
analyze:
name: Analyze (${{ matrix.language }})
needs: detect-languages
if: ${{ needs.detect-languages.outputs.matrix != '{"include":[]}' }}
runs-on: ubuntu-latest
permissions:
security-events: write
packages: read
actions: read
contents: read
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.detect-languages.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{ matrix.language }}"