|
| 1 | +name: Quality Check |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: ["Test and Generate Previews"] |
| 6 | + types: [completed] |
| 7 | + |
| 8 | +jobs: |
| 9 | + quality-check: |
| 10 | + name: AI Quality Evaluation |
| 11 | + runs-on: ubuntu-latest |
| 12 | + if: ${{ github.event.workflow_run.conclusion == 'success' }} |
| 13 | + permissions: |
| 14 | + contents: read |
| 15 | + pull-requests: write |
| 16 | + issues: write |
| 17 | + id-token: write |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + - name: Download preview metadata |
| 26 | + uses: actions/download-artifact@v4 |
| 27 | + with: |
| 28 | + name: preview-metadata |
| 29 | + run-id: ${{ github.event.workflow_run.id }} |
| 30 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 31 | + |
| 32 | + - name: Load metadata |
| 33 | + id: metadata |
| 34 | + run: | |
| 35 | + if [ ! -f preview_metadata.json ]; then |
| 36 | + echo "No preview metadata found, skipping quality check" |
| 37 | + exit 0 |
| 38 | + fi |
| 39 | +
|
| 40 | + PR_NUMBER=$(jq -r '.pr_number' preview_metadata.json) |
| 41 | + BUCKET=$(jq -r '.bucket' preview_metadata.json) |
| 42 | + BASE_PATH=$(jq -r '.base_path' preview_metadata.json) |
| 43 | + CHANGED_FILES=$(jq -r '.changed_files[]' preview_metadata.json | tr '\n' ' ') |
| 44 | +
|
| 45 | + echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT |
| 46 | + echo "bucket=$BUCKET" >> $GITHUB_OUTPUT |
| 47 | + echo "base_path=$BASE_PATH" >> $GITHUB_OUTPUT |
| 48 | + echo "changed_files=$CHANGED_FILES" >> $GITHUB_OUTPUT |
| 49 | +
|
| 50 | + - name: Setup Google Cloud authentication |
| 51 | + uses: google-github-actions/auth@v2 |
| 52 | + with: |
| 53 | + credentials_json: ${{ secrets.GCS_CREDENTIALS }} |
| 54 | + |
| 55 | + - name: Download preview images |
| 56 | + run: | |
| 57 | + mkdir -p preview_images |
| 58 | + gsutil -m cp -r "gs://${{ steps.metadata.outputs.bucket }}/${{ steps.metadata.outputs.base_path }}/*" preview_images/ || echo "No images to download" |
| 59 | +
|
| 60 | + - name: Trigger quality check with @claude |
| 61 | + uses: actions/github-script@v7 |
| 62 | + with: |
| 63 | + script: | |
| 64 | + const prNumber = ${{ steps.metadata.outputs.pr_number }}; |
| 65 | + const bucket = '${{ steps.metadata.outputs.bucket }}'; |
| 66 | + const basePath = '${{ steps.metadata.outputs.base_path }}'; |
| 67 | +
|
| 68 | + await github.rest.issues.createComment({ |
| 69 | + owner: context.repo.owner, |
| 70 | + repo: context.repo.repo, |
| 71 | + issue_number: prNumber, |
| 72 | + body: `@claude |
| 73 | +
|
| 74 | + ## 🎯 Task: Quality Evaluation |
| 75 | +
|
| 76 | + Preview images have been generated and uploaded to GCS. Please evaluate the implementations. |
| 77 | +
|
| 78 | + ### Instructions |
| 79 | +
|
| 80 | + 1. **Preview images location** |
| 81 | + - Already downloaded to \`preview_images/\` directory in this repository |
| 82 | + - GCS Bucket: \`${bucket}\` |
| 83 | + - GCS Path: \`${basePath}/\` |
| 84 | +
|
| 85 | + 2. **For each preview image:** |
| 86 | + - Parse filename to extract: spec_id, library, variant (format: \`{spec_id}_{library}_{variant}.png\`) |
| 87 | + - Read corresponding spec file: \`specs/{spec_id}.md\` |
| 88 | + - View the preview image carefully using your vision capabilities |
| 89 | + - Evaluate against quality criteria listed in the spec |
| 90 | +
|
| 91 | + 3. **Check each quality criterion:** |
| 92 | + - Does it meet ALL quality criteria from the spec? |
| 93 | + - Are visual elements clear and readable? |
| 94 | + - Are colors appropriate and accessible? |
| 95 | + - Is the layout well-structured? |
| 96 | + - Score: 0-100 (≥85 to pass) |
| 97 | +
|
| 98 | + 4. **Generate quality report with:** |
| 99 | + - Overall verdict (PASS if all implementations score ≥85, FAIL otherwise) |
| 100 | + - Score for each implementation (matplotlib and seaborn separately) |
| 101 | + - Specific feedback for each quality criterion (met/failed) |
| 102 | + - Strengths and improvements needed |
| 103 | + - Concrete, actionable suggestions if FAIL |
| 104 | +
|
| 105 | + 5. **Update this PR:** |
| 106 | + - Post quality report as comment on this PR |
| 107 | + - Use \`gh pr edit\` to add appropriate label: |
| 108 | + - "quality-approved" if PASS |
| 109 | + - "quality-check-failed" if FAIL |
| 110 | +
|
| 111 | + ### Scoring Guidelines |
| 112 | + - 90-100: Excellent - All criteria met, production ready |
| 113 | + - 85-89: Good - Minor issues, acceptable |
| 114 | + - 75-84: Needs improvement - regeneration recommended |
| 115 | + - <75: Rejected - Major issues, regeneration required |
| 116 | +
|
| 117 | + Be objective and constructive in your feedback. Focus on measurable criteria. |
| 118 | +
|
| 119 | + Preview images are ready - please proceed with the evaluation!` |
| 120 | + }); |
0 commit comments