feat(workflows): add python-qlty-gate reusable workflow#188
Conversation
|
Warning Review limit reached
More reviews will be available in 53 minutes and 22 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR introduces a new reusable GitHub Actions workflow that standardizes code quality checking via the Qlty CLI. Callers can invoke the workflow with five configurable inputs to run quality checks in either diff mode (comparing against an upstream branch) or full scan mode, with configurable fail levels and reporting. ChangesQlty CI Gate Workflow
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR adds a new reusable GitHub Actions workflow to serve as an organization-wide CI quality gate by running qlty check in either diff mode (PR gating) or full scan mode (scheduled debt tracking), with a stable CheckRun name for ruleset required checks.
Changes:
- Introduces
.github/workflows/python-qlty-gate.ymlas a reusable workflow with inputs controlling severity threshold, diff versus full scan behavior, and informational mode. - Implements secure-by-default workflow structure with workflow-level
permissions: {}, job-level scoped permissions, job timeout, and runner hardening as the first step. - Adds a job summary that records the effective gate settings in the workflow run summary.
| with: | ||
| fetch-depth: 0 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.github/workflows/python-qlty-gate.yml (1)
52-58: ⚡ Quick winConsider adding validation for fail-level input.
The input accepts any string, but line 55 documents only five valid values:
note,fmt,low,medium,high. If a caller passes an invalid value, theqlty checkcommand will fail at runtime. Consider adding a validation step early in the job to fail fast with a clear error message.✅ Proposed validation step
Add this step after checkout and before running qlty:
- name: Validate inputs run: | valid_levels="note fmt low medium high" if ! echo "$valid_levels" | grep -qw "${{ inputs.fail-level }}"; then echo "::error::Invalid fail-level '${{ inputs.fail-level }}'. Must be one of: $valid_levels" exit 1 fi🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/python-qlty-gate.yml around lines 52 - 58, Add an early validation step for the action input named fail-level to ensure it is one of the allowed values ("note", "fmt", "low", "medium", "high") and fail fast with a clear error if not; insert a new job step after checkout and before running the qlty command that checks inputs.fail-level against that whitelist (e.g., compare the input string to the set of valid tokens and emit an error + exit 1 when it does not match) so callers receive a clear message rather than a runtime qlty failure.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/python-qlty-gate.yml:
- Around line 106-109: The Checkout step using
actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd must explicitly
disable credential persistence to avoid exposing GITHUB_TOKEN; in the workflow
(the Checkout action block) add the input persist-credentials: false so the
token is not written into .git/config when running qlty check.
- Around line 114-128: The step can run with neither --all nor --upstream which
leaves qlty check mode ambiguous; add validation before building args to detect
when CHECK_ALL != "true" and UPSTREAM is empty and then either set a sensible
default upstream (e.g., origin/${{ github.event.pull_request.base.ref }} for PR
runs) or abort with a clear error and non‑zero exit; implement this by checking
the env vars CHECK_ALL and UPSTREAM, printing a helpful message to stderr
(including the values) and exiting 1 if neither flag will be provided, or by
populating UPSTREAM with the derived default before appending to args so qlty
check always receives either --all or --upstream.
---
Nitpick comments:
In @.github/workflows/python-qlty-gate.yml:
- Around line 52-58: Add an early validation step for the action input named
fail-level to ensure it is one of the allowed values ("note", "fmt", "low",
"medium", "high") and fail fast with a clear error if not; insert a new job step
after checkout and before running the qlty command that checks inputs.fail-level
against that whitelist (e.g., compare the input string to the set of valid
tokens and emit an error + exit 1 when it does not match) so callers receive a
clear message rather than a runtime qlty failure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 44c4fbd2-dd9d-4eb7-8dbe-25ee302c015c
📒 Files selected for processing (1)
.github/workflows/python-qlty-gate.yml
PR ReviewCI green, SonarCloud Quality Gate passed, no Critical findings. Branch is BEHIND Important (should fix)
Suggested: RAD markers absent on permission scopes / reusable inheritance (project standard mandates them, though the analogous Verified clean: the 🤖 Generated with Claude Code |
Adds a reusable workflow that runs qlty check as a blocking CI gate.
Two modes: diff (PR gate, changed files only) and full scan (scheduled
health checks, --all). The resulting CheckRun is named
"{caller-job-id} / Qlty Gate" -- callers should use job id "qlty-gate"
so the org ruleset required_status_checks entry matches across repos.
Inputs: fail-level (default: medium), check-all, no-fail, upstream,
timeout-minutes.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Address review findings on the new reusable qlty gate: - Set persist-credentials: false on checkout so GITHUB_TOKEN is not written to .git/config while qlty check scans checked-out code (Copilot, CodeRabbit, zizmor artipacked). - Fail fast when neither check-all nor upstream is set, instead of running qlty check in an ambiguous default scope (CodeRabbit). - Validate fail-level against the allowed set (note/fmt/low/medium/high) with an explicit error rather than an opaque CLI failure. - Add the upstream ref row to the job summary so diff-mode runs show their base. - Add RAD markers on the workflow- and job-level permission scopes and on the caller/callee inheritance, per the project RAD standard for workflow YAML. - Point the caller examples at the documented @v1 consumer tag. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add the docs/workflows/python-qlty-gate.md companion page (operating modes, caller examples, inputs table, required-status-check naming) to match the 1:1 workflow-to-doc pattern, and record the workflow under CHANGELOG [Unreleased]. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
040026a to
490c0d8
Compare
|
PR Fix SummaryRebased onto Workflow hardening (
Docs (
Note on the
Threaded replies to the individual review comments could not be posted from the review sandbox (it blocks 🤖 Generated with Claude Code |
Adds qlty-gate job (PR diff gate, fail-level medium) and qlty-health job (weekly full scan, informational). No coverage upload — this is an infra/config repo. Refs: #188 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…kflow Resolve the SonarCloud gate failure on PR #189 (githubactions:S8234, MAJOR): replace workflow-level 'permissions: read-all' with deny-by-default 'permissions: {}'. Both jobs already declare job-scoped 'contents: read', the minimum a diff/health gate needs, matching the python-qlty-gate.yml convention. Also flagged by Copilot. Re-pin the reusable-workflow refs from 040026a (pre-squash feature-branch commit of #188, diverged from main) to 1561a3e, the squash-merge commit on main that contains python-qlty-gate.yml, so the pin is auditable and Renovate-trackable. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds CI-078 (suggested, override-eligible): .github/workflows/qlty.yml must contain a qlty-gate job calling python-qlty-gate.yml. The qlty.sh GitHub App StatusContext always reports SUCCESS regardless of blocking issue count and cannot enforce quality gates; a real GitHub Actions CheckRun from the qlty-gate job is required for enforcement. Allocated CI-078 (not CI-073) to avoid an ID collision with the renovate-health suite's CI-073..077 in PR #189; the companion ruleset follow-up is reserved as a future CI-079. Rebased onto current main. Cross-reference: ByronWilliamsCPA/.github#188, skill-observations log #184. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(ci): add qlty gate and weekly health scan Adds qlty-gate job (PR diff gate, fail-level medium) and qlty-health job (weekly full scan, informational). No coverage upload — this is an infra/config repo. Refs: #188 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ci): deny-by-default permissions and on-main SHA pin for qlty workflow Resolve the SonarCloud gate failure on PR #189 (githubactions:S8234, MAJOR): replace workflow-level 'permissions: read-all' with deny-by-default 'permissions: {}'. Both jobs already declare job-scoped 'contents: read', the minimum a diff/health gate needs, matching the python-qlty-gate.yml convention. Also flagged by Copilot. Re-pin the reusable-workflow refs from 040026a (pre-squash feature-branch commit of #188, diverged from main) to 1561a3e, the squash-merge commit on main that contains python-qlty-gate.yml, so the pin is auditable and Renovate-trackable. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs(changelog): document repo-local qlty.yml caller workflow Add an Unreleased entry for the qlty.yml caller added in PR #189, matching the repo pattern where feat changes update CHANGELOG.md (as sibling PR #188 did). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds CI-078 (suggested, override-eligible): .github/workflows/qlty.yml must contain a qlty-gate job calling python-qlty-gate.yml. The qlty.sh GitHub App StatusContext always reports SUCCESS regardless of blocking issue count and cannot enforce quality gates; a real GitHub Actions CheckRun from the qlty-gate job is required for enforcement. Allocated CI-078 (not CI-073) to avoid an ID collision with the renovate-health suite's CI-073..077 in PR #189; the companion ruleset follow-up is reserved as a future CI-079. Rebased onto current main. Cross-reference: ByronWilliamsCPA/.github#188, skill-observations log #184. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds CI-078 (suggested, override-eligible): .github/workflows/qlty.yml must contain a qlty-gate job calling python-qlty-gate.yml. The qlty.sh GitHub App StatusContext always reports SUCCESS regardless of blocking issue count and cannot enforce quality gates; a real GitHub Actions CheckRun from the qlty-gate job is required for enforcement. Allocated CI-078 (not CI-073) to avoid an ID collision with the renovate-health suite's CI-073..077 in PR #189; the companion ruleset follow-up is reserved as a future CI-079. Rebased onto current main. Cross-reference: ByronWilliamsCPA/.github#188, skill-observations log #184. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds qlty-gate job (PR diff mode, fail-level medium) and qlty-health job (weekly full scan, informational) alongside existing coverage upload. Refs: ByronWilliamsCPA/.github#188 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(ci): add qlty gate and weekly health scan Adds qlty-gate job (PR diff mode, fail-level medium) and qlty-health job (weekly full scan, informational) alongside existing coverage upload. Refs: ByronWilliamsCPA/.github#188 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ci): re-pin qlty-gate reusable workflow to reachable SHA The qlty-gate and qlty-health jobs pinned python-qlty-gate.yml@040026ab, a pre-merge commit from the ByronWilliamsCPA/.github PR #188 branch that is not reachable from that repo's main (the source branch was deleted on merge). GitHub Actions cannot resolve a reusable workflow at an unreachable SHA, so qlty.yml failed at startup on every pull_request event (0 jobs scheduled), and the intended "qlty-gate / Qlty Gate" check never appeared. Re-pin both jobs to 1561a3ef, the #188 merge commit on .github main, which exposes the same input interface (fail-level, check-all, no-fail, upstream) and the same contents: read permissions. Add a CHANGELOG entry documenting the gate and weekly health scan. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>



Summary
Adds a reusable workflow that runs
qlty checkas a blocking CI gate.check-all: true): runsqlty check --all; used for scheduled health scans to track accumulated debt on the default branchThe job inside the reusable workflow is named
Qlty Gate. When called with caller job idqlty-gate(required by convention), the resulting CheckRun name isqlty-gate / Qlty Gate. This is the name to add torequired_status_checksin the org baseline ruleset.Inputs
fail-levelmediumcheck-allfalseno-failfalseupstream''timeout-minutes15Context
Part of a two-PR set to wire up qlty enforcement:
qlty.ymlwith fail-level medium (PR gate) and scheduled full scanThe companion PR references commit
040026ab682aa4b9ef491750d62cdd1592cdb659from this branch.Test plan
python-qlty-gate.ymlvalidates withactionlintqlty-gate / Qlty GateCheckRun after this mergesqlty-gate / Qlty Gateadded toByronWilliamsCPA-default-branch-baselinerequired checksSummary by CodeRabbit