@@ -3,10 +3,6 @@ name: Validate pull request
33on :
44 workflow_call :
55 inputs :
6- pr_number :
7- description : ' Pull request number'
8- required : true
9- type : number
106 base_ref :
117 description : ' Base branch reference'
128 required : true
6864 uses : actions/checkout@v4
6965
7066 - name : Lint DevSite Utils
71- run : |
72- echo "## Lint Results" >> $GITHUB_STEP_SUMMARY
73- echo "" >> $GITHUB_STEP_SUMMARY
74-
75- # Run lint and capture output
76- set +e
77- npm run lint > lint-output.txt 2>&1
78- EXIT_CODE=$?
79- set -e
80-
81- # Check if there are warnings or errors in the output
82- if grep -q "Files with issues:" lint-output.txt || grep -q "⚠️ WARNING" lint-output.txt || [ $EXIT_CODE -ne 0 ]; then
83- echo "⚠️ **Linting issues detected**" >> $GITHUB_STEP_SUMMARY
84- echo "" >> $GITHUB_STEP_SUMMARY
85-
86- # Extract and display summary
87- if grep -q "📊 Linting Summary:" lint-output.txt; then
88- echo "### Summary" >> $GITHUB_STEP_SUMMARY
89- echo '```' >> $GITHUB_STEP_SUMMARY
90- sed -n '/📊 Linting Summary:/,/^$/p' lint-output.txt | grep -E "(Files processed|Files with issues|Total issues|Warnings|fatal)" >> $GITHUB_STEP_SUMMARY
91- echo '```' >> $GITHUB_STEP_SUMMARY
92- echo "" >> $GITHUB_STEP_SUMMARY
93- fi
94-
95- # Display detailed issues
96- echo "### Detailed issues" >> $GITHUB_STEP_SUMMARY
97- echo "" >> $GITHUB_STEP_SUMMARY
98- echo '```' >> $GITHUB_STEP_SUMMARY
99- # Extract file paths and their associated warnings/errors
100- grep -B 1 -E "⚠️|❌|WARNING|ERROR" lint-output.txt | grep -E "^src/pages/.*:|⚠️|❌|WARNING|ERROR" >> $GITHUB_STEP_SUMMARY || cat lint-output.txt >> $GITHUB_STEP_SUMMARY
101- echo '```' >> $GITHUB_STEP_SUMMARY
102-
103- # Output to console as well
104- cat lint-output.txt
105- rm lint-output.txt
106-
107- echo "::warning::Warnings found but no fatal errors. See job summary for details."
108-
109- # Save warning status for the comment workflow
110- echo "true" > has-warnings.txt
111- echo "${{ inputs.pr_number }}" > pr-number.txt
112- else
113- echo "✅ **No issues found!**" >> $GITHUB_STEP_SUMMARY
114- echo "" >> $GITHUB_STEP_SUMMARY
115- echo "All files passed linting checks." >> $GITHUB_STEP_SUMMARY
116- rm -f lint-output.txt
117-
118- # Save no-warning status
119- echo "false" > has-warnings.txt
120- echo "${{ inputs.pr_number }}" > pr-number.txt
121- fi
122-
123- - name : Upload lint results
124- uses : actions/upload-artifact@v4
125- if : always()
126- with :
127- name : lint-results
128- path : |
129- has-warnings.txt
130- pr-number.txt
67+ run : npm run lint
13168
13269 # Gate job that always runs and becomes the required check
13370 validate-pr :
14077 # If no src/pages files changed, pass automatically
14178 if [[ "${{ needs.check-files.outputs.run_validation }}" == "false" ]]; then
14279 echo "✅ No src/pages/ files changed - validation skipped"
143- echo "false" > has-warnings.txt
144- echo "${{ inputs.pr_number }}" > pr-number.txt
14580 exit 0
14681 fi
14782
@@ -158,12 +93,3 @@ jobs:
15893 echo "Remark Lint: ${{ needs.remark-lint.result }}"
15994 exit 1
16095 fi
161-
162- - name : Upload lint results for skipped validation
163- if : needs.check-files.outputs.run_validation == 'false'
164- uses : actions/upload-artifact@v4
165- with :
166- name : lint-results
167- path : |
168- has-warnings.txt
169- pr-number.txt
0 commit comments