LibreChat/.github/workflows/quality-decision.yml
Atef Bellaaj 715bf1f9e9
🧪 feat: Changed-Line Mutation Selection and Single Quality Report Comment (#18111)
Select mutants from changed lines and ignore logging-only mutants; rank survivors by risk topic from whole-word identifier matches.
Publish one quality report comment, edited in place, with the verdict, change risk (coverage gaps and CRAP refactor hints) and mutation survivors grouped by line.
Bundle the report data into one quality-report artifact; shard artifacts are internal.
Map api/ source aliases into coverage evidence and enforce a per-shard execution budget.
Move Redis cluster runtime files out of the checkout.
2026-11-16 08:00:48 -05:00

101 lines
3.4 KiB
YAML

name: Quality Decision
on:
pull_request_target:
types: [opened, reopened, synchronize]
workflow_run:
workflows: [Change Quality]
types: [in_progress, completed]
permissions:
contents: read
actions: write
pull-requests: write
statuses: write
jobs:
resolve:
runs-on: ubuntu-latest
permissions: {}
outputs:
pr: ${{ steps.pr.outputs.pr }}
queue: ${{ steps.pr.outputs.queue }}
steps:
- id: pr
run: |
node <<'JS'
const fs = require('node:fs');
const event = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'));
const run = event.workflow_run;
if (run?.event === 'merge_group' && run.status === 'completed') {
fs.appendFileSync(process.env.GITHUB_OUTPUT, `queue=${run.id}\n`);
}
const match = run?.event === 'issue_comment' && /^Quality PR #(\d+) request \d+$/.exec(run.display_title);
const pr = event.pull_request?.number ?? (match ? Number(match[1]) : undefined);
if (Number.isSafeInteger(pr) && pr > 0) fs.appendFileSync(process.env.GITHUB_OUTPUT, `pr=${pr}\n`);
JS
publish:
needs: [resolve]
if: needs.resolve.outputs.pr != ''
concurrency:
group: quality-decision-${{ needs.resolve.outputs.pr }}
cancel-in-progress: false
queue: max
name: Publish quality decision
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# Never check out or run PR code in this privileged job. It downloads only the small
# findings file, which comment.mts validates and escapes; it never opens the full reports.
- uses: actions/checkout@v5
with:
ref: ${{ github.workflow_sha }}
persist-credentials: false
sparse-checkout: scripts/quality
- uses: actions/setup-node@v5
with:
node-version: '24.22.3'
# A `name` that matches no artifact fails the step. The comment must still update, and
# comment.mts reports the missing file, so this step continues on error.
- name: Download report findings
if: github.event_name == 'workflow_run' && github.event.workflow_run.status == 'completed'
continue-on-error: true
uses: actions/download-artifact@v6
with:
name: quality-internal-findings
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}
path: findings
- env:
GH_TOKEN: ${{ github.token }}
QUALITY_REFACTOR_HINTS: ${{ vars.QUALITY_REFACTOR_HINTS }}
QUALITY_CRAP_THRESHOLD: ${{ vars.QUALITY_CRAP_THRESHOLD }}
run: node scripts/quality/comment.mts publish
queue:
name: Publish queue quality decision
needs: [resolve]
if: needs.resolve.outputs.queue != ''
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
pull-requests: read
actions: read
statuses: write
concurrency:
group: quality-queue-${{ github.event.workflow_run.head_sha }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.workflow_sha }}
persist-credentials: false
sparse-checkout: scripts/quality
- uses: actions/setup-node@v5
with:
node-version: '24.22.1'
- env:
GH_TOKEN: ${{ github.token }}
run: node scripts/quality/queue.mts