Merge pull request #335 from robinje/dependabot/pip/requirements/debu… #290
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dart Format and Analyze | |
on: | |
push: | |
branches: [develop, qa, prod] | |
pull_request: | |
branches: "**" | |
permissions: | |
pull-requests: write | |
contents: write | |
jobs: | |
format-and-analyze: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for all branches and tags | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.x" | |
channel: "stable" | |
- name: Configure Git | |
run: | | |
git fetch --prune | |
git checkout ${{github.head_ref}} --progress | |
git config --global user.name "Dark Relics Automatic" | |
git config --global user.email "[email protected]" | |
- name: Install dependencies | |
working-directory: registration | |
run: flutter pub get | |
- name: Verify formatting | |
working-directory: registration | |
run: dart format . | |
- name: Analyze project source | |
working-directory: registration | |
run: | | |
dart fix --apply | |
dart analyze | |
flutter analyze | |
- name: Check for changes | |
id: git-check | |
run: | | |
git add . -vv | |
if git diff-index --quiet HEAD; then | |
echo "changes=false" >> $GITHUB_OUTPUT | |
else | |
echo "changes=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Commit and push changes | |
if: steps.git-check.outputs.changes == 'true' | |
run: | | |
git pull --rebase origin ${{github.head_ref}} | |
git commit -m "Apply Flutter Autoformatting" -vv | |
git push -vv |