Add all changes from v1.0.0 internal #3
Workflow file for this run
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: "PR" | |
on: | |
pull_request: | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
outputs: | |
files: ${{steps.changed-files.outputs.any_changed}} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
persist-credentials: false | |
- name: Check branch is up to date | |
run: | | |
if git merge-base --is-ancestor ${{ github.event.pull_request.base.sha}} ${{ github.event.pull_request.head.sha}} | |
then | |
echo "Your branch is up to date." | |
exit 0 | |
else | |
echo "You need to merge / rebase." | |
exit 1 | |
fi | |
- name: Get all changed *.dart, files in docs or pubspec.yaml | |
id: changed-files | |
uses: tj-actions/changed-files@v37 | |
with: | |
base_sha: ${{ github.event.pull_request.base.sha }} | |
sha: ${{ github.event.pull_request.head.sha }} | |
files: | | |
**/*.dart | |
pubspec.yaml | |
analyze: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
needs: changes | |
if: needs.changes.outputs.files == 'true' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.head_ref }} | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.13.x" | |
channel: "stable" | |
- name: Setup flutter | |
run: flutter pub get | |
- name: Lint and format | |
run: | | |
dart format . -l 120 | |
dart fix --apply | |
dart analyze | |
- name: Check for modified files | |
id: git-check | |
run: echo "modified=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi)" >> $GITHUB_ENV | |
- name: Update changes in GitHub repository | |
if: env.modified == 'true' | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
git add -A | |
git commit -m '[automated commit] lint format and import sort' | |
git push |