Skip to content

feat(CI): Added GitHub Actions to check for code style violations #3

feat(CI): Added GitHub Actions to check for code style violations

feat(CI): Added GitHub Actions to check for code style violations #3

Workflow file for this run

name: Check for formatting
on:
push:
pull_request:
jobs:
check-format:
name: Check if code needs formatting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Maven
uses: actions/setup-java@v4
with:
java-version: 21
distribution: zulu
- name: Check if code aligns with code style
id: check
run: mvn spotless:check
continue-on-error: true
- name: Generate Summary
run: |

Check failure on line 24 in .github/workflows/check-format.yml

View workflow run for this annotation

GitHub Actions / Check for formatting

Invalid workflow file

The workflow is not valid. .github/workflows/check-format.yml (Line: 24, Col: 14): Unrecognized named-value: 'jobs'. Located at position 1 within expression: jobs.check.result
if [ ${{ jobs.check.result }} == 'success' ]; then
echo ":ballot_box_with_check: No formatting issues found." >> $GITHUB_STEP_SUMMARY
exit 0
else
echo ":negative_squared_cross_mark: Formatting issues found!" >> $GITHUB_STEP_SUMMARY
echo "```" >> $GITHUB_STEP_SUMMARY
gh run view ${{ github.run_id }} --log | grep "ERROR" | sed 's/Check if code needs formatting Check if code aligns with code style [0-9A-Z:.-]\+//' | sed 's/\[ERROR] //' >> $GITHUB_STEP_SUMMARY
echo "```" >> $GITHUB_STEP_SUMMARY
exit 1
fi