Repository navigation
Conversation
Allow projects to self-service enable GitHub code scanning (CodeQL default setup) from .asf.yaml, as requested in apache#94: github: code_scanning: true or, for more control: github: code_scanning: query_suite: extended threat_model: remote languages: - java-kotlin The directive reads the current default setup configuration first and only issues a PATCH when the desired settings differ, avoiding redundant analysis runs. Removing the section disables the setup only if it was previously managed via .asf.yaml, following the semantics established in apache#121. Language identifiers are deliberately not validated client-side, as GitHub extends the CodeQL language set over time. Assisted-By: Claude Fable 5 <noreply@anthropic.com>
An explicit `code_scanning: false` now returns early unless the setup was previously managed through `.asf.yaml`, matching the guard used by the sibling directives, so a default setup enabled by INFRA is left untouched. Document the disable semantics in the README. Assisted-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HG2YkEme3CUshbsNKK1GRH
Send query_suite in the PATCH payload only when the user set it, like threat_model and languages, and drop the strictyaml-injected "default" default so an omitted key truly leaves the suite unmanaged. This prevents .asf.yaml from silently downgrading a default setup that INFRA configured with the extended suite. Assisted-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HG2YkEme3CUshbsNKK1GRH
Accept any 2xx status for the default setup PATCH, matching the sibling directives, so an unexpected success code is not reported as an error (which would also skip writing the settings cache and repeat on every push). Guard the JSON parse of the GET response so a 200 with a non-JSON body produces a helpful message instead of a raw JSONDecodeError. Assisted-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HG2YkEme3CUshbsNKK1GRH
Removing a key from the code_scanning map keeps its last applied value on GitHub's side; document this and the disable/re-enable cycle as the way to return to automatic language selection. Verified against the live API on a scratch repository: omitted PATCH fields keep their previous values, "languages": [] means "no languages selected" rather than a reset to auto-detection, and a disable/re-enable cycle resets the whole configuration. Assisted-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HG2YkEme3CUshbsNKK1GRH
Assisted-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HG2YkEme3CUshbsNKK1GRH
|
@potiuk all five of your review comments are now addressed (each thread has a reply with the corresponding commit; the sticky-fields one includes results of testing the API semantics on a scratch repo). Could you take another look when you have a moment? |
|
Sandbox-tested against my own sandbox (rebased onto current
Note for anyone testing this: immediately after the PATCH, the API still reports One gap. if not configured and not was_previously_configured:
returnreturns before the This is the same shape as a bug I just fixed in #111, and the same fix applies: the Smaller thing: |
Allows projects to self-service enable GitHub code scanning (CodeQL default setup) from
.asf.yaml, as requested in #94 (code scanning part only; secret scanning can be a follow-up):or, for more control:
Design notes:
enabledkey), matching howrulesetsworks; a plain boolean is accepted for the simple case./repos/{org}/{repo}/code-scanning/default-setupfirst and only PATCHes when the desired settings differ, so unrelated.asf.yamledits do not re-trigger analysis runs, and both 200 and 202 (async validation run) are treated as success..asf.yaml(sameprevious_yamlsemantics as Clear branch protection rules when protected_branches is removed #121); a setup enabled manually through the GitHub UI is left untouched.languagesvalues are deliberately not validated client-side, since GitHub extends the CodeQL language set over time; invalid values surface as a GitHub 422 relayed to the committer by email, as are the 403/409 cases (archived repo, setup change in progress, Actions disabled).github_copilot_code_review.pyfake-requester pattern; README documents the new section.Fixes #94
🤖 Generated with Claude Code