-
-
Notifications
You must be signed in to change notification settings - Fork 3
80 lines (72 loc) · 2.29 KB
/
editorconfig-check.yml
File metadata and controls
80 lines (72 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: EditorConfig Check
on:
push:
branches: [main, develop]
paths:
- '.editorconfig'
- '**/.editorconfig'
- '**/*'
pull_request:
branches: [main, develop]
paths:
- '.editorconfig'
- '**/.editorconfig'
- '**/*'
workflow_dispatch:
jobs:
editorconfig-check:
name: 🔍 EditorConfig Lint
runs-on: ubuntu-latest
env:
ALLOW_WARNINGS: false
steps:
- name: 📦 Checkout Repository
uses: actions/checkout@v4
- name: 📥 Download EditorConfig Checker
shell: bash
run: |
wget -q https://github.com/editorconfig-checker/editorconfig-checker/releases/latest/download/ec-linux-amd64.tar.gz
mkdir ec-checker
tar -xzf ec-linux-amd64.tar.gz -C ec-checker
BIN=$(find ec-checker -type f -executable -name "ec*" | head -n 1)
if [ -n "$BIN" ]; then
chmod +x "$BIN"
sudo mv "$BIN" /usr/local/bin/ec
else
echo "❌ Error: ec binary not found after extraction"
exit 1
fi
- name: ▶️ Run EditorConfig Checker
run: |
ec --version
ec --disable-logs 2>&1 | tee ec-output.txt || true
- name: 📋 Generate Markdown Summary
if: always()
shell: bash
run: |
echo "### 🔍 EditorConfig Check Summary" > ec-summary.md
if grep -q "^\[" ec-output.txt; then
echo "**Violations found:**" >> ec-summary.md
head -n 20 ec-output.txt >> ec-summary.md
echo "\n...output truncated..." >> ec-summary.md
else
echo "✅ No violations detected." >> ec-summary.md
fi
cat ec-summary.md >> $GITHUB_STEP_SUMMARY
- name: 📂 Upload Lint Results as Artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: editorconfig-lint-results
path: |
ec-output.txt
ec-summary.md
retention-days: 30
- name: 🚫 Fail if Violations Exist and Not Allowed
if: always()
shell: bash
run: |
if [ "$ALLOW_WARNINGS" != "true" ] && grep -q "^\[" ec-output.txt; then
echo "❌ Failing the job due to EditorConfig violations."
exit 1
fi