feature/IVYPORTAL-16678-SPIKE-Setup-Linter #13
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: false | |
# Enable specific linters | |
VALIDATE_JAVA: true | |
VALIDATE_JAVASCRIPT_ES: true | |
VALIDATE_JSON: true | |
VALIDATE_YAML: true | |
VALIDATE_XML: true | |
VALIDATE_CSS: true | |
# Configure file discovery | |
FILTER_REGEX_INCLUDE: .*portal/src/.*\.java | |
JAVA_SOURCE_PATH: portal/src/ | |
# Add linter configurations | |
JAVA_FILE_NAME: checkstyle.xml | |
JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.json | |
# Add debug mode for troubleshooting | |
LOG_LEVEL: DEBUG | |
LOG_FILE: true | |
# Configure output | |
LINTER_RULES_PATH: ./ | |
REPORT_OUTPUT: true | |
CREATE_LOG_FILE: true | |
OUTPUT_FOLDER: /tmp/lint-results # Set output folder explicitly | |
OUTPUT_FORMAT: text | |
- name: Process Linter Results | |
if: always() | |
run: | | |
if [ -f "/tmp/lint-results/super-linter.log" ]; then | |
cp /tmp/lint-results/super-linter.log /tmp/lint-results/linter.log | |
else | |
echo "No super-linter.log found, checking alternative locations..." | |
find /tmp/lint-results -name "super-linter.log" -type f -exec cp {} /tmp/lint-results/linter.log \; | |
if [ ! -f "/tmp/lint-results/linter.log" ]; then | |
echo "No linting issues found" > /tmp/lint-results/linter.log | |
fi | |
fi | |
- name: Upload Linter Report | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linter-report | |
path: /tmp/lint-results/ | |
retention-days: 1 | |
- name: Generate Summary | |
run: | | |
echo "### Linter Summary" > $GITHUB_STEP_SUMMARY | |
if [ -f ./linter-report/linter.log ]; then | |
if grep -E "ERROR|WARNING" ./linter-report/linter.log > /dev/null; then | |
grep -E "ERROR|WARNING" ./linter-report/linter.log >> $GITHUB_STEP_SUMMARY | |
else | |
echo "No linting issues found" >> $GITHUB_STEP_SUMMARY | |
fi | |
else | |
echo "No linter report found" >> $GITHUB_STEP_SUMMARY | |
fi | |
- name: Check Linter Status | |
if: always() | |
run: | | |
if [ -f "./linter-report/linter.log" ] && grep -E "ERROR" ./linter-report/linter.log > /dev/null; then | |
exit 1 | |
fi |