Skip to content

Commit 80910dc

Browse files
fix: license check on flutter package (#436)
* fix: license check for flutter package * chore: use variables
1 parent 5bf4391 commit 80910dc

File tree

3 files changed

+48
-3
lines changed

3 files changed

+48
-3
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ jobs:
5555
forbidden: "unknown"
5656
skip_packages: "very_good_analysis"
5757

58+
verify-license-check-flutter:
59+
uses: ./.github/workflows/license_check.yml
60+
with:
61+
working_directory: examples/flutter_package
62+
flutter_channel: stable
63+
flutter_version: "3.41.x"
64+
dependency_type: "direct-dev"
65+
allowed: ""
66+
forbidden: "unknown"
67+
skip_packages: "very_good_analysis"
68+
5869
build:
5970
needs:
6071
[
@@ -65,6 +76,7 @@ jobs:
6576
verify-semantic-pull-request,
6677
verify-spell-check,
6778
verify-license-check,
79+
verify-license-check-flutter,
6880
]
6981

7082
runs-on: ubuntu-latest

.github/workflows/license_check.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ on:
1515
required: false
1616
type: string
1717
default: "stable"
18+
flutter_channel:
19+
required: false
20+
type: string
21+
default: "stable"
22+
flutter_version:
23+
required: false
24+
type: string
25+
default: ""
1826
allowed:
1927
required: false
2028
type: string
@@ -47,15 +55,28 @@ jobs:
4755

4856
runs-on: ${{inputs.runs_on}}
4957

58+
env:
59+
is_flutter: ${{ inputs.flutter_version != '' }}
60+
5061
steps:
5162
- name: 📚 Git Checkout
5263
uses: actions/checkout@v6
5364

5465
- name: 🎯 Setup Dart
66+
if: env.is_flutter == 'false'
5567
uses: dart-lang/setup-dart@v1.7.2
5668
with:
5769
sdk: ${{inputs.dart_sdk}}
5870

71+
- name: 🐦 Setup Flutter
72+
if: env.is_flutter == 'true'
73+
uses: subosito/flutter-action@v2
74+
with:
75+
cache: true
76+
channel: ${{inputs.flutter_channel}}
77+
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
78+
flutter-version: ${{inputs.flutter_version}}
79+
5980
- name: 🤫 Set SSH Key
6081
env:
6182
ssh_key: ${{secrets.ssh_key}}
@@ -65,7 +86,7 @@ jobs:
6586
ssh-private-key: ${{secrets.ssh_key}}
6687

6788
- name: 📦 Install Dependencies
68-
run: dart pub get --no-example
89+
run: ${{ env.is_flutter == 'true' && 'flutter' || 'dart' }} pub get --no-example
6990

7091
- name: 👨‍⚖️ Check licenses
7192
run: |

site/docs/workflows/license_check.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The License Check functionality is powered by [Very Good CLI's license checker](
1414

1515
The License Check workflow consists of the following steps:
1616

17-
1. Setup Dart
17+
1. Setup Dart or Flutter
1818
2. Set SSH Key (if provided)
1919
3. Install project dependencies
2020
4. Check licenses
@@ -35,10 +35,22 @@ The License Check workflow consists of the following steps:
3535

3636
### `dart_sdk`
3737

38-
**Optional** Which Dart SDK version to use. It can be a version (e.g. `3.5.0`) or a channel (e.g. `stable`):
38+
**Optional** Which Dart SDK version to use. It can be a version (e.g. `3.5.0`) or a channel (e.g. `stable`). Ignored when `flutter_version` is set.
3939

4040
**Default** `"stable"`
4141

42+
### `flutter_channel`
43+
44+
**Optional** The Flutter channel to use (e.g. `stable`, `beta`). Only used when `flutter_version` is set.
45+
46+
**Default** `"stable"`
47+
48+
### `flutter_version`
49+
50+
**Optional** Which Flutter SDK version to use. When set, Flutter is used instead of Dart to install dependencies. It can be a version (e.g. `3.24.0`) or a version constraint (e.g. `3.24.x`).
51+
52+
**Default** `""`
53+
4254
### `allowed`
4355

4456
**Optional** Only allow the use of certain licenses. The expected format is a comma-separated list.

0 commit comments

Comments
 (0)