name: Check PR code
on:
  pull_request:
    branches:
      - master

jobs:
  Lint:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository code
        uses: actions/checkout@v4
      - uses: actions/setup-java@v4
        with:
          distribution: 'temurin'
          java-version: '17'
          cache: gradle
      - name: Install klint
        run: curl -sSLO https://github.com/pinterest/ktlint/releases/download/1.0.0/ktlint && chmod a+x ktlint && mv ktlint /usr/local/bin/
      - name: Install detekt
        run: curl -sSLO https://github.com/detekt/detekt/releases/download/v1.23.1/detekt-cli-1.23.1.zip && unzip detekt-cli-1.23.1.zip
      - name: Linting...
        run: ktlint 'shared/**/*.kt' 'androidApp/**/*.kt' '!shared/build' || true
      - name: Detecting...
        run: ./detekt-cli-1.23.1/bin/detekt-cli --all-rules --excludes '**/shared/build/**/*.kt' || true
  build:
    uses: ./.gitea/workflows/common_build.yml