Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: impl cache hit outputs #346

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ steps:
echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
echo PUB-CACHE-PATH=${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}
echo CACHE-HIT=${{ steps.flutter-action.outputs.CACHE-HIT }}
```

If you don't need to install Flutter and just want the outputs, you can use the
Expand All @@ -361,6 +362,7 @@ steps:
echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
echo PUB-CACHE-PATH=${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}
echo CACHE-HIT=${{ steps.flutter-action.outputs.CACHE-HIT }}
shell: bash
```
[Alif Rachmawadi]: https://github.com/subosito
Expand Down
9 changes: 9 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ outputs:
GIT_SOURCE:
value: "${{ steps.flutter-action.outputs.GIT_SOURCE }}"
description: Git source of Flutter SDK repository to clone
CACHE-HIT:
value: "${{ steps.cache-hit-pub.outputs.cache-hit }}"
description: Whether the Pub cache was a hit

runs:
using: composite
Expand Down Expand Up @@ -118,6 +121,7 @@ runs:

- name: Cache pub dependencies
uses: actions/cache@v4
id: cache-pub
if: ${{ inputs.cache == 'true' }}
with:
path: ${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
Expand All @@ -126,6 +130,11 @@ runs:
${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}-${{ hashFiles('**/pubspec.lock') }}
${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}

- name: Set pub cache hit outputs
id: cache-hit-pub
shell: bash
run: echo "cache-hit=${{ steps.cache-pub.outputs.cache-hit }}" >> "$GITHUB_OUTPUT"

- name: Run setup script
shell: bash
if: ${{ inputs.dry-run != 'true' && inputs.dry-run != true }}
Expand Down