feature/IVYPORTAL-16678-SPIKE-Setup-Linter #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Super-Linter | |
on: | |
push: | |
branches: | |
- feature/IVYPORTAL-16678-SPIKE-Setup-Linter | |
pull_request: | |
branches: | |
- master | |
jobs: | |
lint: | |
name: Lint Code Base | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: read | |
statuses: write | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Create Report Directory | |
run: mkdir -p /tmp/lint-results | |
- name: Run Super-Linter | |
uses: super-linter/[email protected] | |
continue-on-error: true | |
id: linter | |
env: | |
DEFAULT_BRANCH: master | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VALIDATE_ALL_CODEBASE: true | |
VALIDATE_JAVA: true | |
VALIDATE_JAVASCRIPT_ES: true | |
VALIDATE_JSON: true | |
VALIDATE_YAML: true | |
VALIDATE_XML: true | |
VALIDATE_CSS: true | |
LOG_LEVEL: VERBOSE | |
LOG_FILE: true | |
REPORT_OUTPUT: true | |
CREATE_LOG_FILE: true | |
OUTPUT_FOLDER: /github/workspace | |
OUTPUT_FORMAT: detailed | |
OUTPUT_DETAILS: detailed | |
ACTIONS_RUNNER_DEBUG: true | |
- name: Debug Linter Output | |
if: always() | |
run: | | |
echo "=== Checking for linter output files ===" | |
find /github/workspace -name "*lint*.log" -o -name "super-linter.log" || true | |
find /tmp -name "*lint*.log" -o -name "super-linter.log" 2>/dev/null || true | |
echo "=== Contents of workspace ===" | |
ls -la /github/workspace || true | |
echo "=== Contents of super-linter-reports ===" | |
ls -la /github/workspace/super-linter-reports || true | |
- name: Process Linter Results | |
if: always() | |
run: | | |
mkdir -p /tmp/lint-results | |
# Check directly in container output | |
echo "=== Checking container logs ===" | |
docker logs $(docker ps -q --filter "ancestor=ghcr.io/super-linter/super-linter:v7.2.1") > /tmp/lint-results/container.log 2>&1 || true | |
echo "=== Creating summary ===" | |
{ | |
echo "### Super-Linter Results" | |
echo "" | |
echo "| Language | Status | Details |" | |
echo "|----------|--------|----------|" | |
# Process container logs | |
while IFS= read -r line; do | |
if [[ $line == *"LANGUAGE:"* && $line == *"STATUS:"* ]]; then | |
LANGUAGE=$(echo "$line" | grep -o "LANGUAGE:[^ ]*" | cut -d: -f2) | |
STATUS=$(echo "$line" | grep -o "STATUS:[^ ]*" | cut -d: -f2) | |
DETAILS=$(echo "$line" | grep -o "ERRORS:.*" || echo "-") | |
echo "| $LANGUAGE | $STATUS | $DETAILS |" | |
elif [[ $line == *"ERROR"* || $line == *"WARNING"* ]]; then | |
echo "$line" >> /tmp/lint-results/errors.log | |
fi | |
done < /tmp/lint-results/container.log | |
} > /tmp/lint-results/summary.md | |
# Ensure we have error logs | |
touch /tmp/lint-results/errors.log | |
- name: Upload Linter Report | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linter-report | |
path: | | |
/tmp/lint-results/summary.md | |
/tmp/lint-results/errors.log | |
/tmp/lint-results/container.log | |
retention-days: 1 | |
- name: Generate Summary | |
if: always() | |
run: | | |
{ | |
cat /tmp/lint-results/summary.md | |
echo "" | |
echo "### Detailed Errors" | |
echo '```' | |
cat /tmp/lint-results/errors.log || echo "No errors found" | |
echo '```' | |
} >> $GITHUB_STEP_SUMMARY | |
- name: Check Linter Status | |
if: always() | |
run: | | |
if grep -q "ERROR:" /tmp/lint-results/container.log; then | |
exit 1 | |
fi |