Skip to content

Commit 44ac965

Browse files
kzrnmbartekpacia
andauthored
Add dry-run (#270)
* Add dry-run * Add dry-run test * format --------- Co-authored-by: Bartek Pacia <[email protected]>
1 parent 980391a commit 44ac965

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

.github/workflows/workflow.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
operating-system:
2929
[ubuntu-latest, windows-latest, macos-latest, macos-13, macos-14]
3030
channel: [stable, beta, master]
31+
dry-run: [true, false]
3132
include:
3233
- operating-system: ubuntu-latest
3334
channel: main
@@ -39,6 +40,7 @@ jobs:
3940
uses: ./
4041
with:
4142
channel: ${{ matrix.channel }}
43+
dry-run: ${{ matrix.dry-run }}
4244
- name: Echo outputs
4345
run: |
4446
echo RUNNER-OS=${{ runner.os }}
@@ -51,8 +53,16 @@ jobs:
5153
echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
5254
shell: bash
5355
- run: dart --version
56+
if: ${{ matrix.dry-run != 'true' }}
5457
shell: bash
5558
- run: flutter --version
59+
if: ${{ matrix.dry-run != 'true' }}
60+
shell: bash
61+
- run: "! dart --version"
62+
if: ${{ matrix.dry-run == 'true' }}
63+
shell: bash
64+
- run: "! flutter --version"
65+
if: ${{ matrix.dry-run == 'true' }}
5666
shell: bash
5767

5868
test_cache:

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,30 @@ steps:
282282
echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}
283283
```
284284

285+
If you don't need to install Flutter and just want the outputs, you can use the
286+
`dry-run` option:
287+
288+
```yaml
289+
steps:
290+
- name: Clone repository
291+
- uses: actions/checkout@v4
292+
- name: Set up Flutter
293+
uses: subosito/flutter-action@v2
294+
id: flutter-action
295+
with:
296+
channel: stable
297+
dry-run: true
298+
- run: |
299+
echo CACHE-PATH=${{ steps.flutter-action.outputs.CACHE-PATH }}
300+
echo CACHE-KEY=${{ steps.flutter-action.outputs.CACHE-KEY }}
301+
echo CHANNEL=${{ steps.flutter-action.outputs.CHANNEL }}
302+
echo VERSION=${{ steps.flutter-action.outputs.VERSION }}
303+
echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
304+
echo PUB-CACHE-PATH=${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
305+
echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}
306+
shell: bash
307+
```
308+
285309
## Maintainers
286310

287311
- [Alif Rachmawadi] (original creator)

action.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ inputs:
4242
description: Flutter pub cache path
4343
required: false
4444
default: default
45+
dry-run:
46+
description: If true, get outputs but do not install Flutter
47+
required: false
48+
default: "false"
4549

4650
outputs:
4751
CHANNEL:
@@ -108,6 +112,7 @@ runs:
108112
109113
- name: Run setup script
110114
shell: bash
115+
if: ${{ inputs.dry-run != 'true' }}
111116
run: |
112117
$GITHUB_ACTION_PATH/setup.sh \
113118
-n '${{ steps.flutter-action.outputs.VERSION }}' \

0 commit comments

Comments
 (0)