Skip to content

Commit 47bc36f

Browse files
committed
add super-linter action
1 parent b6fbfbe commit 47bc36f

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

.github/workflows/super-linter.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
name: Lint
3+
4+
on:
5+
push:
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
# ✅ Step 1: Run Super-Linter in check-only mode (does not fix issues)
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Run Super-Linter (Check Only)
22+
uses: super-linter/super-linter@v7.3.0
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
26+
# ✅ Step 2: Run Super-Linter in fix mode and commit changes
27+
fix-lint-issues:
28+
permissions:
29+
contents: write # Allows writing fixed files
30+
statuses: write # Allows updating PR status
31+
checks: write # Allows updating PR checks
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
38+
39+
- name: Run Super-Linter (Fix Mode)
40+
uses: super-linter/super-linter@v7.3.0
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
# ✅ Enable auto-fix for Shell, Python, YAML, and Markdown:
44+
FIX_SHELL_SHFMT: true
45+
FIX_YAML_PRETTIER: true
46+
FIX_PYTHON_BLACK: true
47+
FIX_PYTHON_ISORT: true
48+
FIX_PYTHON_PYINK: true
49+
FIX_MARKDOWN: true
50+
FIX_TERRAFORM_FMT: true
51+
VALIDATE_TERRAFORM_FMT: true
52+
VALIDATE_TERRAFORM_TERRASCAN: true
53+
VALIDATE_TERRAFORM_TFLINT: true
54+
55+
- name: Commit and push linting fixes
56+
if: github.event_name == 'pull_request' && github.ref_name != github.event.repository.default_branch
57+
uses: stefanzweifel/git-auto-commit-action@v5
58+
with:
59+
branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
60+
commit_message: "chore: fix linting issues"
61+
commit_user_name: super-linter
62+
commit_user_email: super-linter@super-linter.dev

0 commit comments

Comments
 (0)