This repository has been archived on 2026-11-08. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
qqq-orb/.github/workflows/qbit-codeql.yml
James MaesandCodex 04a929aae9 ci: retain Ruby coverage in shared CodeQL selection
Select Ruby for tracked .rb files alongside existing language detection. Covers qctl Java/Ruby/Actions, Ruby-only repositories and untracked-file exclusion.

Validation: red/green regression, seven selector tests, actionlint and two workflow contracts passed; actual qctl branch inventories select the expected languages. Consumer repins and scanner setup changes are outside this PR.

Co-Authored-By: Codex (GPT-6) <noreply@openai.com>
2026-10-29 16:05:19 -05:00

61 lines
2.4 KiB
YAML

name: QBit CodeQL
'on':
workflow_call:
permissions:
contents: read
actions: read
security-events: write
packages: read
jobs:
analyze:
name: Analyze branch source
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Select languages present in this checkout
id: languages
run: |
python3 <<'PY'
import os
from pathlib import PurePosixPath
import subprocess
import sys
files = subprocess.check_output(['git', 'ls-files', '-z']).decode('utf-8').split('\0')
extensions = {PurePosixPath(name).suffix.lower() for name in files if name}
languages = []
if extensions & {'.java', '.kt', '.kts'}:
languages.append('java-kotlin')
if extensions & {'.js', '.jsx', '.mjs', '.cjs', '.ts', '.tsx', '.mts', '.cts'}:
languages.append('javascript-typescript')
if '.py' in extensions:
languages.append('python')
if '.rb' in extensions:
languages.append('ruby')
if any((name.startswith('.github/workflows/') and PurePosixPath(name).suffix in {'.yml', '.yaml'})
or PurePosixPath(name).name in {'action.yml', 'action.yaml'} for name in files if name):
languages.append('actions')
if not languages:
sys.exit('No supported source in this branch; classify placeholders before enabling QBit scanning')
build_mode = 'autobuild' if extensions & {'.kt', '.kts'} else 'none'
with open(os.environ['GITHUB_OUTPUT'], 'a', encoding='utf-8') as output:
output.write('languages=' + ','.join(languages) + '\n')
output.write('build-mode=' + build_mode + '\n')
PY
- uses: actions/setup-java@v4
if: steps.languages.outputs.build-mode == 'autobuild'
with:
distribution: temurin
java-version: '21'
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ steps.languages.outputs.languages }}
build-mode: ${{ steps.languages.outputs.build-mode }}
- name: Build Kotlin sources
if: steps.languages.outputs.build-mode == 'autobuild'
uses: github/codeql-action/autobuild@v4
- name: Analyze source
uses: github/codeql-action/analyze@v4