Files
semantica/.github/workflows/codeql.yml
T
KaifAhmad1andClaude Sonnet 4.6 8b47c148c5 fix(codeql): split disable-default-setup into separate job with confirmation
The previous fix used || true in a single-step which masked API failures
and had no propagation delay — Default Setup remained active when the
SARIF upload ran, causing the same conflict error.

Changes:
- New job `disable-default-setup` runs first: calls the API, waits 30s,
  then polls to confirm state=not-configured before exiting
- `analyze` job depends on `disable-default-setup` via `needs:` so CodeQL
  only runs after the state change is confirmed propagated

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 20:15:13 +05:30

68 lines
1.8 KiB
YAML

name: CodeQL
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '30 1 * * 1' # Every Monday 7 AM IST
permissions:
contents: read
security-events: write
actions: read
jobs:
disable-default-setup:
name: Disable CodeQL Default Setup
runs-on: ubuntu-latest
steps:
- name: Switch Default Setup to not-configured
env:
GH_TOKEN: ${{ github.token }}
run: |
echo "Disabling CodeQL Default Setup..."
gh api repos/${{ github.repository }}/code-scanning/default-setup \
-X PATCH \
-f state=not-configured
- name: Wait for Default Setup state to propagate
run: sleep 30
- name: Confirm Default Setup is disabled
env:
GH_TOKEN: ${{ github.token }}
run: |
STATE=$(gh api repos/${{ github.repository }}/code-scanning/default-setup \
--jq '.state')
echo "Default Setup state: $STATE"
if [ "$STATE" != "not-configured" ]; then
echo "Default Setup is still enabled — cannot proceed with Advanced Setup."
exit 1
fi
echo "Default Setup confirmed disabled. Proceeding with Advanced Setup."
analyze:
name: Analyze Python
runs-on: ubuntu-latest
needs: disable-default-setup
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: python
queries: security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:python"