Skip to content

Commit 89f2b8a

Browse files
authored
feat: introduce license_check workflow (#154)
1 parent fc1016b commit 89f2b8a

File tree

7 files changed

+163
-3
lines changed

7 files changed

+163
-3
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ jobs:
4646
with:
4747
modified_files_only: false
4848

49+
verify-license-check:
50+
uses: ./.github/workflows/license_check.yml
51+
with:
52+
working_directory: examples/dart_package
53+
dependency_type: "direct-dev"
54+
allowed: ""
55+
forbidden: "unknown"
56+
skip_packages: "very_good_analysis"
57+
4958
build:
5059
needs:
5160
[
@@ -55,6 +64,7 @@ jobs:
5564
verify-pana-flutter,
5665
verify-semantic-pull-request,
5766
verify-spell-check,
67+
verify-license-check,
5868
]
5969

6070
runs-on: ubuntu-latest
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: License Check Workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
working_directory:
7+
required: false
8+
type: string
9+
default: "."
10+
runs_on:
11+
required: false
12+
type: string
13+
default: "ubuntu-latest"
14+
dart_sdk:
15+
required: false
16+
type: string
17+
default: "stable"
18+
allowed:
19+
required: false
20+
type: string
21+
default: "MIT,BSD-3-Clause,BSD-2-Clause,Apache-2.0"
22+
forbidden:
23+
required: false
24+
type: string
25+
default: ""
26+
skip_packages:
27+
required: false
28+
type: string
29+
default: ""
30+
dependency_type:
31+
required: false
32+
type: string
33+
default: "direct-main,transitive"
34+
ignore_retrieval_failures:
35+
required: false
36+
type: boolean
37+
default: false
38+
secrets:
39+
ssh_key:
40+
required: false
41+
42+
jobs:
43+
build:
44+
defaults:
45+
run:
46+
working-directory: ${{inputs.working_directory}}
47+
48+
runs-on: ${{inputs.runs_on}}
49+
50+
steps:
51+
- name: 📚 Git Checkout
52+
uses: actions/checkout@v4
53+
54+
- name: 🎯 Setup Dart
55+
uses: dart-lang/setup-dart@v1
56+
with:
57+
sdk: ${{inputs.dart_sdk}}
58+
59+
- name: 🤫 Set SSH Key
60+
env:
61+
ssh_key: ${{secrets.ssh_key}}
62+
if: env.ssh_key != null
63+
uses: webfactory/[email protected]
64+
with:
65+
ssh-private-key: ${{secrets.ssh_key}}
66+
67+
- name: 📦 Install Dependencies
68+
run: dart pub get --no-example
69+
70+
- name: 👨‍⚖️ Check licenses
71+
run: |
72+
dart pub global activate very_good_cli
73+
dart pub global run very_good_cli:very_good packages check licenses --skip-packages=${{inputs.skip_packages}} --dependency-type=${{inputs.dependency_type}} ${{(inputs.ignore_retrieval_failures && '--ignore-retrieval-failures') || ''}} --allowed=${{inputs.allowed}} --forbidden=${{inputs.forbidden}}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_pub_publish.
4444

4545
# A reusable workflow for publishing Mason bricks
4646
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/mason_publish.yml@v1
47+
48+
# A reusable workflow to keep track of the rights and restrictions external dependencies might impose on Dart or Flutter projects
49+
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/license_check.yml@v1
4750
```
4851
4952
For configuration details, check out our [official docs][workflows_docs].
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
sidebar_position: 5
3+
---
4+
5+
# License Check
6+
7+
At VGV, we keep track of the rights and restrictions external dependencies might impose on Dart or Flutter projects.
8+
9+
:::info
10+
The License Check functionality is powered by [Very Good CLI's license checker](https://cli.vgv.dev/docs/commands/check_licenses), for a deeper understanding of some [inputs](#inputs) refer to its [documentation](https://cli.vgv.dev/docs/commands/check_licenses).
11+
:::
12+
13+
## Steps
14+
15+
The License Check workflow consists of the following steps:
16+
17+
1. Setup Dart
18+
2. Set SSH Key (if provided)
19+
3. Install project dependencies
20+
4. Check licenses
21+
22+
## Inputs
23+
24+
### `working_directory`
25+
26+
**Optional** The path to the root of the Dart or Flutter package.
27+
28+
**Default** `"."`
29+
30+
### `runs_on`
31+
32+
**Optional** An optional operating system on which to run the workflow.
33+
34+
**Default** `"ubuntu-latest"`
35+
36+
### `dart_sdk`
37+
38+
**Optional** Which Dart SDK version to use. It can be a version (e.g. `2.12.0`) or a channel (e.g. `stable`):
39+
40+
**Default** `"stable"`
41+
42+
### `allowed`
43+
44+
**Optional** Only allow the use of certain licenses. The expected format is a comma-separated list.
45+
46+
**Default** `"MIT,BSD-3-Clause,BSD-2-Clause,Apache-2.0"`
47+
48+
### `forbidden`
49+
50+
**Optional** Deny the use of certain licenses. The expected format is a comma-separated list.
51+
52+
**Default** `""`
53+
54+
:::warning
55+
The allowed and forbidden options can't be used at the same time. If you want to use `forbidden` set `allowed` to an empty string.
56+
:::
57+
58+
### `skip_packages`
59+
60+
**Optional** Skip packages from having their licenses checked.
61+
62+
**Default** `""`
63+
64+
### `dependency_type`
65+
66+
**Optional** The type of dependencies to check licenses for.
67+
68+
**Default** `"direct-main,transitive"`
69+
70+
### `ignore_retrieval_failures`
71+
72+
**Optional** Disregard licenses that failed to be retrieved.
73+
74+
**Default** `false`

site/docs/workflows/mason_publish.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 5
2+
sidebar_position: 6
33
---
44

55
# Mason Publish

site/docs/workflows/pana.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 6
2+
sidebar_position: 7
33
---
44

55
# Pana

site/docs/workflows/spell_check.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 7
2+
sidebar_position: 9
33
---
44

55
# Spell Check

0 commit comments

Comments
 (0)