Update dart.yml

This commit is contained in:
2025-04-27 15:15:26 +02:00
committed by GitHub
parent e4a621a42c
commit e65a957f85

View File

@@ -23,15 +23,22 @@ jobs:
flutter-version: '3.29.2' flutter-version: '3.29.2'
channel: 'stable' channel: 'stable'
- name: Linting project - name: Check Formatting
run: flutter analyze id: check_format
run: |
dart format --set-exit-if-changed . || echo "::set-output name=needs_formatting::true"
flutter analyze
format: format:
runs-on: macos-latest runs-on: macos-latest
needs: lint needs: lint
# Only when lint fails, and its a push to develop branch # Only when lint fails, and its a push to develop branch
if: ${{ failure() }} && github.event_name == 'push' #&& github.ref == 'refs/heads/develop' if: |
failure() &&
needs.lint.outputs.needs_formatting == 'true' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/develop'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -44,25 +51,25 @@ jobs:
- name: Get & upgrade dependencies - name: Get & upgrade dependencies
run: | run: |
flutter pub get flutter pub get
flutter pub upgrade --major-versions # flutter pub upgrade --major-versions
- name: Formatting Code
- name: Auto-format
run: | run: |
flutter analyze dart format . # Korrigiert Formatierung
dart fix --apply dart fix --apply # Behebt einfache Issues
dart format . --set-exit-if-changed || true
- name: Commit Changes
- name: Commit Format Changes
#if: failure() && steps.format.outcome == 'failure'
run: | run: |
git config --global user.name "GitHub Actions" git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com" git config --global user.email "actions@github.com"
git add . git add .
git commit -m "Pipeline: Auto-formatting" git commit -m "style: Auto-formatting [skip ci]"
git push git push
build: build:
runs-on: macos-latest runs-on: macos-latest
if: false # skips job
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4