Skip to content

Commit 4eef41c

Browse files
authored
Add agentic workflow for automated super-linter analysis and reporting (#4)
1 parent 2da1f53 commit 4eef41c

File tree

1 file changed

+157
-0
lines changed

1 file changed

+157
-0
lines changed
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "0 14 * * 1-5" # 2 PM UTC, weekdays only
6+
permissions:
7+
contents: read
8+
actions: read
9+
safe-outputs:
10+
create-issue:
11+
title-prefix: "[linter] "
12+
labels: [automation, code-quality]
13+
engine: copilot
14+
name: Super Linter Report
15+
timeout_minutes: 15
16+
steps:
17+
- name: Checkout Code
18+
uses: actions/checkout@v5
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v6
24+
with:
25+
node-version-file: .node-version
26+
cache: npm
27+
28+
- name: Install Dependencies
29+
run: npm ci
30+
31+
- name: Run Super Linter
32+
id: super-linter
33+
continue-on-error: true
34+
uses: super-linter/super-linter/slim@v8
35+
env:
36+
CHECKOV_FILE_NAME: .checkov.yml
37+
DEFAULT_BRANCH: main
38+
FILTER_REGEX_EXCLUDE: dist/**/*
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
LINTER_RULES_PATH: .
41+
VALIDATE_ALL_CODEBASE: true
42+
# Disable linters that are covered by other workflows or not applicable
43+
VALIDATE_BIOME_FORMAT: false # Prettier is used instead
44+
VALIDATE_BIOME_LINT: false # ESLint is used instead
45+
VALIDATE_GITHUB_ACTIONS_ZIZMOR: false # Separate security workflow
46+
VALIDATE_JAVASCRIPT_ES: false # ESLint handles JS/TS linting
47+
VALIDATE_JSCPD: false # Copy-paste detection not required
48+
VALIDATE_TYPESCRIPT_ES: false # ESLint handles TypeScript
49+
VALIDATE_JSON: false # Not strictly enforced in this project
50+
LOG_FILE: super-linter.log
51+
CREATE_LOG_FILE: true
52+
53+
- name: Save Linter Output
54+
if: always()
55+
run: |
56+
mkdir -p /tmp/gh-aw
57+
if [ -f "super-linter.log" ]; then
58+
cp super-linter.log /tmp/gh-aw/linter-output.txt
59+
else
60+
echo "No super-linter.log file found" > /tmp/gh-aw/linter-output.txt
61+
fi
62+
63+
# Also capture GitHub step summary if available
64+
if [ -n "$GITHUB_STEP_SUMMARY" ]; then
65+
echo "" >> /tmp/gh-aw/linter-output.txt
66+
echo "---" >> /tmp/gh-aw/linter-output.txt
67+
cat "$GITHUB_STEP_SUMMARY" >> /tmp/gh-aw/linter-output.txt 2>/dev/null || true
68+
fi
69+
tools:
70+
bash:
71+
- 'cat /tmp/gh-aw/linter-output.txt'
72+
---
73+
74+
# Super Linter Analysis Report
75+
76+
You are an expert code quality analyst. Your task is to analyze the super-linter output and create a comprehensive issue report.
77+
78+
## Context
79+
80+
- **Repository**: ${{ github.repository }}
81+
- **Triggered by**: @${{ github.actor }}
82+
- **Run ID**: ${{ github.run_id }}
83+
84+
## Your Task
85+
86+
1. **Read the linter output** from `/tmp/gh-aw/linter-output.txt` using the bash tool
87+
2. **Analyze the findings**:
88+
- Categorize errors by severity (critical, high, medium, low)
89+
- Group errors by file or linter type
90+
- Identify patterns in the errors
91+
- Determine which errors are most important to fix first
92+
3. **Create a detailed issue** with the following structure:
93+
94+
### Issue Title
95+
Use format: "Code Quality Report - [Date] - [X] issues found"
96+
97+
### Issue Body Structure
98+
99+
```markdown
100+
## 🔍 Super Linter Analysis Summary
101+
102+
**Date**: [Current date]
103+
**Total Issues Found**: [Number]
104+
**Run ID**: ${{ github.run_id }}
105+
106+
## 📊 Breakdown by Severity
107+
108+
- **Critical**: [Count and brief description]
109+
- **High**: [Count and brief description]
110+
- **Medium**: [Count and brief description]
111+
- **Low**: [Count and brief description]
112+
113+
## 📁 Issues by Category
114+
115+
### [Category/Linter Name]
116+
- **File**: `path/to/file`
117+
- Line [X]: [Error description]
118+
- Impact: [Why this matters]
119+
- Suggested fix: [How to resolve]
120+
121+
[Repeat for other categories]
122+
123+
## 🎯 Priority Recommendations
124+
125+
1. [Most critical issue to address first]
126+
2. [Second priority]
127+
3. [Third priority]
128+
129+
## 📋 Full Linter Output
130+
131+
<details>
132+
<summary>Click to expand complete linter log</summary>
133+
134+
```
135+
[Include the full linter output here]
136+
```
137+
138+
</details>
139+
140+
## 🔗 References
141+
142+
- [Link to workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
143+
- [Super Linter Documentation](https://github.com/super-linter/super-linter)
144+
```
145+
146+
## Important Guidelines
147+
148+
- **Be concise but thorough**: Focus on actionable insights
149+
- **Prioritize issues**: Not all linting errors are equal
150+
- **Provide context**: Explain why each type of error matters
151+
- **Suggest fixes**: Give practical recommendations
152+
- **Use proper formatting**: Make the issue easy to read and navigate
153+
- **If no errors found**: Create a positive report celebrating clean code
154+
155+
## Security Note
156+
157+
Treat linter output as potentially sensitive. Do not expose credentials, API keys, or other secrets that might appear in file paths or error messages.

0 commit comments

Comments
 (0)