Files
Ornot/.gitea/workflows/linting.yml
Josh Chester 62ecf143a1
All checks were successful
Java Google Checkstyle / Checkstyle Linter (pull_request) Successful in 36s
Build with gradle / Build-with-gradle (pull_request) Successful in 1m31s
Tweak action triggers
2026-01-24 12:47:37 -06:00

58 lines
1.6 KiB
YAML

name: Java Google Checkstyle
run-name: Linting for ${{ gitea.actor }}
permissions:
contents: read
pull-request: write
on:
pull_request:
push:
branches:
- 'main'
jobs:
checkstyle:
name: 'Checkstyle Linter'
runs-on: ubuntu-latest
env:
CHECKSTYLE_VERSION: '13.0.0'
REVIEWDOG_VERSION: 'latest'
REVIEWDOG_GITEA_API_TOKEN: ${{ secrets.REVIEWDOG_TOKEN }}
GITEA_ADDRESS: http://gitea:3000
steps:
- name: 'Setup Java JDK'
uses: actions/setup-java@v4
with:
java-version: '22'
distribution: 'zulu'
- name: 'Setup Reviewdog'
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
- name: 'Pull code'
uses: actions/checkout@v6
- name: 'Find changed Java files'
id: changed-files
uses: tj-actions/changed-files@v44
with:
files: |
**.java
- name: 'Run Checkstyle with Reviewdog'
if: steps.changed-files.outputs.any_changed == 'true'
run: |
wget https://github.com/checkstyle/checkstyle/releases/download/checkstyle-${{ env.CHECKSTYLE_VERSION }}/checkstyle-${{ env.CHECKSTYLE_VERSION }}-all.jar
echo "Changed files:"
echo "${{ steps.changed-files.outputs.all_changed_files }}"
java -jar checkstyle-${{ env.CHECKSTYLE_VERSION }}-all.jar -c ./style_guide.xml -f xml ${{ steps.changed-files.outputs.all_changed_files }} \
| reviewdog -f=checkstyle \
-name="Checkstyle" \
-reporter="gitea-pr-review" \
-level="warning" \
-fail-on-error="true"