actions-linting-example.yml
name: Code Quality with Linting Composite Actions
# This example workflow demonstrates how to use the argus linter
# composite actions for comprehensive code quality checking. Copy this to your
# repository and customize as needed.
#
# Available Linter Actions:
# - linter-yaml: YAML syntax and style validation
# - linter-json: JSON syntax validation
# - linter-python: Python code quality (flake8)
# - linter-javascript: JavaScript syntax and quality (JSHint)
# - linter-dockerfile: Dockerfile best practices (Hadolint)
# - linter-terraform: Terraform formatting and validation
# - linting-summary: Aggregate all linter results
#
# Each linter runs independently and generates summaries that can be combined
# by the linting-summary action.
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pull-requests: write
actions: read
env:
PYTHON_VERSION: '3.12'
jobs:
# YAML Linting
yaml-lint:
name: YAML Linting
runs-on: ubuntu-latest
timeout-minutes: 5
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Run YAML Linter
uses: huntridge-labs/argus/.github/actions/linter-yaml@1.1.0
with:
fail_on_issues: false
# config_file: '.yamllint.yml' # Optional: custom config
# JSON Validation
json-lint:
name: JSON Validation
runs-on: ubuntu-latest
timeout-minutes: 5
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Run JSON Linter
uses: huntridge-labs/argus/.github/actions/linter-json@1.1.0
with:
fail_on_issues: false
# Python Code Quality
python-lint:
name: Python Code Quality
runs-on: ubuntu-latest
timeout-minutes: 10
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Run Python Linter
uses: huntridge-labs/argus/.github/actions/linter-python@1.1.0
with:
fail_on_issues: false
python_version: ${{ env.PYTHON_VERSION }}
# max_line_length: '120' # Optional: configure in argus.yml
# JavaScript Code Quality
javascript-lint:
name: JavaScript Code Quality
runs-on: ubuntu-latest
timeout-minutes: 10
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Run JavaScript Linter
uses: huntridge-labs/argus/.github/actions/linter-javascript@1.1.0
with:
fail_on_issues: false
# Dockerfile Linting
dockerfile-lint:
name: Dockerfile Linting
runs-on: ubuntu-latest
timeout-minutes: 5
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Run Dockerfile Linter
uses: huntridge-labs/argus/.github/actions/linter-dockerfile@1.1.0
with:
fail_on_issues: false
# ignore_rules: 'DL3008,DL3009' # Optional: ignore specific rules
# Terraform Linting
terraform-lint:
name: Terraform Linting
runs-on: ubuntu-latest
timeout-minutes: 10
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Run Terraform Linter
uses: huntridge-labs/argus/.github/actions/linter-terraform@1.1.0
with:
fail_on_issues: false
# terraform_version: 'latest' # Optional: configure in argus.yml
# run_tflint: true # Optional: configure in argus.yml
# Summary Job - Collect all linter results
linting-summary:
name: Linting Summary
runs-on: ubuntu-latest
needs: [yaml-lint, json-lint, python-lint, javascript-lint, dockerfile-lint, terraform-lint]
if: always()
steps:
- name: Generate Combined Linting Summary
uses: huntridge-labs/argus/.github/actions/linting-summary@1.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: 'Code Quality & Linting Summary'
show_metadata: true
show_stats: true
post_pr_comment: true
- name: Check job statuses
run: |
echo "Job Status Summary:"
echo "===================="
echo "YAML: ${{ needs.yaml-lint.result }}"
echo "JSON: ${{ needs.json-lint.result }}"
echo "Python: ${{ needs.python-lint.result }}"
echo "JavaScript: ${{ needs.javascript-lint.result }}"
echo "Dockerfile: ${{ needs.dockerfile-lint.result }}"
echo "Terraform: ${{ needs.terraform-lint.result }}"
# Optional: Fail if any critical linters failed
# Uncomment the following if you want the summary job to fail
# if [[ "${{ needs.yaml-lint.result }}" == "failure" ]] || \
# [[ "${{ needs.json-lint.result }}" == "failure" ]]; then
# echo "One or more critical linters failed"
# exit 1
# fi
echo "Linting workflow completed"