name: on-pr
permissions:
  contents: read

on:
    workflow_dispatch:
    pull_request:

jobs:
  format_check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: Set up JDK 17
        uses: actions/setup-java@v5
        with:
          distribution: 'temurin'
          java-version: '17'
          cache: gradle

      - name: Grant execute permission for gradlew
        run: chmod +x gradlew

      - name: Run ktfmt
        run: ./gradlew ktfmtCheck
