Skip to content

feat(github-action): add super-linter action #9

feat(github-action): add super-linter action

feat(github-action): add super-linter action #9

Workflow file for this run

---
name: Lint
on:
push:
pull_request:
permissions:
contents: read
jobs:
# ✅ Step 1: Run Super-Linter in check-only mode (does not fix issues)
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Super-Linter (Check Only)
uses: super-linter/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_MARKDOWN: true
VALIDATE_TERRAFORM_FMT: true
VALIDATE_TERRAFORM_TERRASCAN: true
VALIDATE_TERRAFORM_TFLINT: true
VALIDATE_PYTHON_BLACK: true
VALIDATE_PYTHON_PYLINT: true
VALIDATE_PYTHON_ISORT: true
VALIDATE_PYTHON_MYPY: true
VALIDATE_PYTHON_BANDIT: true
# ✅ Step 2: Run Super-Linter in fix mode and commit changes
fix-lint-issues:
permissions:
contents: write # Allows writing fixed files
statuses: write # Allows updating PR status
checks: write # Allows updating PR checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Super-Linter (Fix Mode)
uses: super-linter/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ✅ Enable auto-fix for Shell, Python, YAML, Markdown, and Terraform:
FIX_SHELL_SHFMT: true
FIX_YAML_PRETTIER: true
FIX_PYTHON_BLACK: true
FIX_PYTHON_ISORT: true
FIX_PYTHON_PYINK: true
FIX_MARKDOWN: true
FIX_TERRAFORM_FMT: true
FIX_TERRAFORM_TERRASCAN: true
FIX_TERRAFORM_TFLINT: true
- name: Commit and push linting fixes
if: github.event_name == 'pull_request' && github.ref_name != github.event.repository.default_branch
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
commit_message: "chore: fix linting issues"
commit_user_name: super-linter
commit_user_email: [email protected]