8787 editorconfig-check :
8888 name : 🔍 EditorConfig Lint
8989 runs-on : ubuntu-latest
90+ env :
91+ ALLOW_WARNINGS : false
9092
9193 steps :
9294 - name : 📦 Checkout Repository
98100 wget -q https://github.com/editorconfig-checker/editorconfig-checker/releases/latest/download/ec-linux-amd64.tar.gz
99101 mkdir ec-checker
100102 tar -xzf ec-linux-amd64.tar.gz -C ec-checker
101-
102103 BIN=$(find ec-checker -type f -executable -name "ec*" | head -n 1)
103104 if [ -n "$BIN" ]; then
104105 chmod +x "$BIN"
@@ -109,6 +110,38 @@ jobs:
109110 fi
110111
111112 - name : ▶️ Run EditorConfig Checker
113+ id : ec-check
114+ shell : bash
112115 run : |
116+ echo "🔍 Running EditorConfig Checker..."
113117 ec --version
114- ec --disable-logs || true # Avoid failure on style warnings
118+ if ec --disable-logs > ec-output.txt 2>&1; then
119+ echo "✅ No violations found."
120+ echo "passed=true" >> $GITHUB_OUTPUT
121+ else
122+ echo "⚠️ Violations found."
123+ echo "passed=false" >> $GITHUB_OUTPUT
124+ fi
125+
126+ - name : 📝 Generate GitHub Summary
127+ if : always()
128+ shell : bash
129+ run : |
130+ echo "### 🧾 EditorConfig Check Summary" >> $GITHUB_STEP_SUMMARY
131+ echo "- Commit: [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})" >> $GITHUB_STEP_SUMMARY
132+ echo "- Branch: `${{ github.ref_name }}`" >> $GITHUB_STEP_SUMMARY
133+ echo "" >> $GITHUB_STEP_SUMMARY
134+
135+ if [ -f ec-output.txt ]; then
136+ echo '```' >> $GITHUB_STEP_SUMMARY
137+ head -n 100 ec-output.txt >> $GITHUB_STEP_SUMMARY
138+ echo '```' >> $GITHUB_STEP_SUMMARY
139+ else
140+ echo "No output file found." >> $GITHUB_STEP_SUMMARY
141+ fi
142+
143+ - name : 🚫 Fail if Violations Exist and Not Allowed
144+ if : steps.ec-check.outputs.passed == 'false' && env.ALLOW_WARNINGS != 'true'
145+ run : |
146+ echo "❌ Failing the job due to EditorConfig violations."
147+ exit 1
0 commit comments