feature/IVYPORTAL-16678-SPIKE-Setup-Linter #3
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 | |
LOG_LEVEL: WARN | |
REPORT_OUTPUT: true | |
- name: Ensure Report File Exists | |
if: always() | |
run: | | |
touch /tmp/lint-results/linter.log | |
if [ ! -s /tmp/lint-results/linter.log ]; then | |
echo "No linting issues found" > /tmp/lint-results/linter.log | |
fi | |
- name: Upload Linter Report | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linter-report | |
path: /tmp/lint-results/ | |
retention-days: 1 | |
summary: | |
name: Generate Summary | |
needs: lint | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- name: Download Linter Report | |
uses: actions/download-artifact@v4 | |
with: | |
name: linter-report | |
path: ./linter-report | |
- 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 |