11name : PR Checks - Comment
22
3- # This workflow posts PR check results as comments
3+ # This workflow posts ADVISORY check results as comments
44# Runs in the main repo context with write permissions (SAFE)
55# Triggered after pr-checks-run.yml completes
6+ #
7+ # NOTE: PR title and size checks are handled by pr-checks.yml (no duplication)
8+ # This workflow only posts backend/frontend advisory check results
69
710on :
811 workflow_run :
@@ -19,7 +22,7 @@ permissions:
1922
2023jobs :
2124 comment :
22- name : Post Check Results
25+ name : Post Advisory Check Results
2326 runs-on : ubuntu-latest
2427 # Only run if the workflow was triggered by a pull_request event
2528 if : github.event.workflow_run.event == 'pull_request'
@@ -37,31 +40,14 @@ jobs:
3740 ls -la artifacts/ || echo "No artifacts directory"
3841 find artifacts/ -type f || echo "No files found"
3942
40- - name : Read PR info results
41- id : pr-info
42- continue-on-error : true
43- run : |
44- if [ -f artifacts/pr-info-results/pr-info.json ]; then
45- echo "=== PR Info JSON ==="
46- cat artifacts/pr-info-results/pr-info.json
47- echo "pr_number=$(jq -r '.pr_number' artifacts/pr-info-results/pr-info.json)" >> $GITHUB_OUTPUT
48- echo "title_status=$(jq -r '.title_status' artifacts/pr-info-results/pr-info.json)" >> $GITHUB_OUTPUT
49- echo "title_message=$(jq -r '.title_message' artifacts/pr-info-results/pr-info.json)" >> $GITHUB_OUTPUT
50- echo "size=$(jq -r '.size' artifacts/pr-info-results/pr-info.json)" >> $GITHUB_OUTPUT
51- echo "lines=$(jq -r '.lines' artifacts/pr-info-results/pr-info.json)" >> $GITHUB_OUTPUT
52- echo "size_suggestion=$(jq -r '.size_suggestion' artifacts/pr-info-results/pr-info.json)" >> $GITHUB_OUTPUT
53- else
54- echo "pr_number=0" >> $GITHUB_OUTPUT
55- echo "⚠️ PR info artifact not found"
56- fi
57-
5843 - name : Read backend results
5944 id : backend
6045 continue-on-error : true
6146 run : |
6247 if [ -f artifacts/backend-results/backend-results.json ]; then
6348 echo "=== Backend Results JSON ==="
6449 cat artifacts/backend-results/backend-results.json
50+ echo "pr_number=$(jq -r '.pr_number' artifacts/backend-results/backend-results.json)" >> $GITHUB_OUTPUT
6551 echo "fmt_status=$(jq -r '.fmt_status' artifacts/backend-results/backend-results.json)" >> $GITHUB_OUTPUT
6652 echo "vet_status=$(jq -r '.vet_status' artifacts/backend-results/backend-results.json)" >> $GITHUB_OUTPUT
6753 echo "test_status=$(jq -r '.test_status' artifacts/backend-results/backend-results.json)" >> $GITHUB_OUTPUT
8369 echo "EOF" >> $GITHUB_OUTPUT
8470 fi
8571 else
72+ echo "pr_number=0" >> $GITHUB_OUTPUT
8673 echo "⚠️ Backend results artifact not found"
8774 fi
8875
9380 if [ -f artifacts/frontend-results/frontend-results.json ]; then
9481 echo "=== Frontend Results JSON ==="
9582 cat artifacts/frontend-results/frontend-results.json
96- echo "lint_status=$(jq -r '.lint_status' artifacts/frontend-results/frontend-results.json)" >> $GITHUB_OUTPUT
97- echo "typecheck_status=$(jq -r '.typecheck_status' artifacts/frontend-results/frontend-results.json)" >> $GITHUB_OUTPUT
9883 echo "build_status=$(jq -r '.build_status' artifacts/frontend-results/frontend-results.json)" >> $GITHUB_OUTPUT
9984
10085 # Read output files
101- if [ -f artifacts/frontend-results/lint-output-short.txt ]; then
102- echo "lint_output<<EOF" >> $GITHUB_OUTPUT
103- cat artifacts/frontend-results/lint-output-short.txt >> $GITHUB_OUTPUT
104- echo "EOF" >> $GITHUB_OUTPUT
105- fi
106- if [ -f artifacts/frontend-results/typecheck-output-short.txt ]; then
107- echo "typecheck_output<<EOF" >> $GITHUB_OUTPUT
108- cat artifacts/frontend-results/typecheck-output-short.txt >> $GITHUB_OUTPUT
109- echo "EOF" >> $GITHUB_OUTPUT
110- fi
11186 if [ -f artifacts/frontend-results/build-output-short.txt ]; then
11287 echo "build_output<<EOF" >> $GITHUB_OUTPUT
11388 cat artifacts/frontend-results/build-output-short.txt >> $GITHUB_OUTPUT
@@ -117,29 +92,16 @@ jobs:
11792 echo "⚠️ Frontend results artifact not found"
11893 fi
11994
120- - name : Post combined comment
121- if : steps.pr-info .outputs.pr_number != '0'
95+ - name : Post advisory results comment
96+ if : steps.backend .outputs.pr_number != '0'
12297 uses : actions/github-script@v7
12398 with :
12499 script : |
125- const prNumber = ${{ steps.pr-info.outputs.pr_number }};
126-
127- // PR Info section
128- const titleStatus = '${{ steps.pr-info.outputs.title_status }}' || '⚠️ Unknown';
129- const prSize = '${{ steps.pr-info.outputs.size }}' || '⚠️ Unknown';
130- const prLines = '${{ steps.pr-info.outputs.lines }}' || '0';
131- const sizeSuggestion = '${{ steps.pr-info.outputs.size_suggestion }}' || '';
132-
133- let comment = '## 🤖 PR Checks Results\n\n';
134- comment += 'Thank you for your contribution! Here are the automated check results:\n\n';
135-
136- // PR Info
137- comment += '### 📋 PR Information\n\n';
138- comment += '**Title Format:** ' + titleStatus + '\n';
139- comment += '**PR Size:** ' + prSize + ' (' + prLines + ' lines changed)\n';
140- if (sizeSuggestion) {
141- comment += '\n💡 **Suggestion:** ' + sizeSuggestion + '\n';
142- }
100+ const prNumber = ${{ steps.backend.outputs.pr_number }};
101+
102+ let comment = '## 🤖 Advisory Check Results\n\n';
103+ comment += 'These are **advisory** checks to help improve code quality. They won\'t block your PR from being merged.\n\n';
104+ comment += '> **Note:** PR title and size checks are handled by the main workflow and may appear in a separate comment.\n\n';
143105
144106 // Backend checks
145107 const fmtStatus = '${{ steps.backend.outputs.fmt_status }}';
@@ -182,43 +144,21 @@ jobs:
182144 }
183145
184146 // Frontend checks
185- const lintStatus = '${{ steps.frontend.outputs.lint_status }}';
186- const typecheckStatus = '${{ steps.frontend.outputs.typecheck_status }}';
187147 const buildStatus = '${{ steps.frontend.outputs.build_status }}';
188148
189- if (lintStatus || typecheckStatus || buildStatus) {
149+ if (buildStatus) {
190150 comment += '\n### ⚛️ Frontend Checks\n\n';
191151
192- if (lintStatus) {
193- comment += '**Linting:** ' + lintStatus + '\n';
194- const lintOutput = `${{ steps.frontend.outputs.lint_output }}`;
195- if (lintOutput && lintOutput.trim()) {
196- comment += '<details><summary>Issues found</summary>\n\n```\n' + lintOutput.substring(0, 500) + '\n```\n</details>\n\n';
197- }
198- }
199-
200- if (typecheckStatus) {
201- comment += '**Type Checking:** ' + typecheckStatus + '\n';
202- const typecheckOutput = `${{ steps.frontend.outputs.typecheck_output }}`;
203- if (typecheckOutput && typecheckOutput.trim()) {
204- comment += '<details><summary>Type errors</summary>\n\n```\n' + typecheckOutput.substring(0, 500) + '\n```\n</details>\n\n';
205- }
206- }
207-
208- if (buildStatus) {
209- comment += '**Build:** ' + buildStatus + '\n';
210- const buildOutput = `${{ steps.frontend.outputs.build_output }}`;
211- if (buildOutput && buildOutput.trim()) {
212- comment += '<details><summary>Build output</summary>\n\n```\n' + buildOutput.substring(0, 500) + '\n```\n</details>\n\n';
213- }
152+ comment += '**Build & Type Check:** ' + buildStatus + '\n';
153+ const buildOutput = `${{ steps.frontend.outputs.build_output }}`;
154+ if (buildOutput && buildOutput.trim()) {
155+ comment += '<details><summary>Build output</summary>\n\n```\n' + buildOutput.substring(0, 1000) + '\n```\n</details>\n\n';
214156 }
215157
216158 comment += '\n**Fix locally:**\n';
217159 comment += '```bash\n';
218160 comment += 'cd web\n';
219- comment += 'npm run lint -- --fix # Fix linting\n';
220- comment += 'npm run type-check # Check types\n';
221- comment += 'npm run build # Test build\n';
161+ comment += 'npm run build # Test build (includes type checking)\n';
222162 comment += '```\n';
223163 }
224164
0 commit comments