diff --git a/.gitea/workflows/pull_request.yaml b/.gitea/workflows/pull_request.yaml index dcc95c1..6299f66 100644 --- a/.gitea/workflows/pull_request.yaml +++ b/.gitea/workflows/pull_request.yaml @@ -56,4 +56,44 @@ 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 & upgrade dependencies + run: | + flutter pub get + flutter pub upgrade --major-versions + + - name: Auto-format + run: | + dart format . + dart fix --apply + + - name: Commit Changes + if: steps.check_changes.outputs.changes_detected == 'true' + run: | + # git config --global user.name "GitHub Actions" + # git config --global user.email "actions@github.com" + git add . + git commit -m "Actions: Auto-formatting [skip ci]" + git push \ No newline at end of file