-
-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
56 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,6 @@ jobs: | |
access_token: ${{ github.token }} | ||
|
||
analyze: | ||
name: Format, fix & analyze Code | ||
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
|
@@ -39,17 +38,8 @@ jobs: | |
if: ${{ inputs.sdk == 'flutter' }} | ||
|
||
- run: ${{ inputs.sdk }} pub get | ||
|
||
- run: dart format . | ||
|
||
- run: dart fix --apply | ||
|
||
# actions/checkout fetches only a single commit in a detached HEAD state. Therefore | ||
# we need to pass the current branch, otherwise we can't commit the changes. | ||
# GITHUB_HEAD_REF is the name of the head branch. GitHub Actions only sets this for PRs. | ||
- run: ../scripts/commit-formatted-code.sh $GITHUB_HEAD_REF | ||
if: env.GITHUB_HEAD_REF != null | ||
|
||
- run: dart format --set-exit-if-changed ./ | ||
|
||
- name: dart analyze | ||
uses: invertase/github-action-dart-analyzer@1cda5922c6369263b1c7e2fbe281f69704f4d63e # [email protected] | ||
with: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
cancel-previous-workflow: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # [email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
format-and-fix: | ||
name: Format & fix code | ||
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
strategy: | ||
matrix: | ||
package: [ | ||
{name: dart, sdk: dart}, | ||
{name: dio, sdk: dart}, | ||
{name: file, sdk: dart}, | ||
{name: flutter, sdk: flutter}, | ||
{name: logging, sdk: dart}, | ||
{name: sqflite, sdk: flutter}, | ||
] | ||
defaults: | ||
run: | ||
working-directory: ${{ matrix.package.name }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d # pin@v1 | ||
if: ${{ matrix.package.sdk == 'dart' }} | ||
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # [email protected] | ||
if: ${{ matrix.package.sdk == 'flutter' }} | ||
|
||
- run: ${{ matrix.package.sdk }} pub get | ||
|
||
- run: dart format . | ||
|
||
- run: dart fix --apply | ||
|
||
# Source: https://stackoverflow.com/a/58035262 | ||
- name: Extract branch name | ||
shell: bash | ||
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | ||
id: extract_branch | ||
|
||
# actions/checkout fetches only a single commit in a detached HEAD state. Therefore | ||
# we need to pass the current branch, otherwise we can't commit the changes. | ||
# GITHUB_HEAD_REF is the name of the head branch. GitHub Actions only sets this for PRs. | ||
- name: Commit & push | ||
run: ./scripts/commit-formatted-code.sh ${{ steps.extract_branch.outputs.branch }} |