diff --git a/.gitea/workflows/pull_request.yaml b/.gitea/workflows/pull_request.yaml index 43d36d2..c7e8904 100644 --- a/.gitea/workflows/pull_request.yaml +++ b/.gitea/workflows/pull_request.yaml @@ -6,6 +6,7 @@ on: jobs: lint: runs-on: ubuntu-latest + if: never() steps: - name: Checkout code uses: actions/checkout@v4 @@ -32,6 +33,7 @@ jobs: test: runs-on: ubuntu-latest + if: never() steps: - name: Checkout code uses: actions/checkout@v4 @@ -54,4 +56,41 @@ jobs: run: flutter pub get - name: Run tests - run: flutter test \ No newline at end of file + run: flutter test + + format: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + apt-get update + apt-get install -y jq + + - name: Install Flutter (wget) + run: | + wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.2-stable.tar.xz + tar xf flutter_linux_3.38.2-stable.tar.xz + # Set Git safe directory for Flutter path + git config --global --add safe.directory "$(pwd)/flutter" + # Set Flutter path + echo "$(pwd)/flutter/bin" >> $GITHUB_PATH + + - name: Get dependencies + run: flutter pub get + + - name: Check code format + run: | + flutter format --set-exit-if-changed . + + - name: Format code + if: failure() + run: | + flutter format . + git config --global user.name "liquid-actions[bot]" + git config --global user.email "gitea@liquid-dev.de" + git add . + git commit -m "Auto-format code" + git push