Skip to content

Run actions on main to cache, disable build on PR (#32) #30

Run actions on main to cache, disable build on PR (#32)

Run actions on main to cache, disable build on PR (#32) #30

name: Autoformat and Lint
on:
push:
branches:
- main
pull_request:
jobs:
autoformat:
name: Autoformat and Lint
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: 🛎 Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.WORKFLOW_COMMIT }}
- name: 🎯 Setup Dart
uses: dart-lang/setup-dart@v1
- name: 🐦 Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- name: 📦 Get dependencies
run: flutter pub get
- name: 🤖 Build dart files
run: dart run build_runner build
- name: 📝 Format Code
run: dart format .
- name: 🔧 Fix Linting Issues
run: dart fix --apply
- name: ✅ Commit code format changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Autoformat code"
- name: 🔍 Lint Flutter
run: flutter analyze