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

Conversation

anies1212
Copy link

@anies1212 anies1212 commented Jan 24, 2025

What does this PR do?

This PR adds a new output, cache-hit, to the flutter-action. The cache-hit output indicates whether the cache was successfully hit during the setup process. This can help optimize workflows by conditionally executing subsequent steps based on cache status.

Why is this change necessary?

In our project, we manage a monorepo using melos. As part of our CI/CD pipeline, we run melos bs (bootstrap) every time to set up dependencies and link packages. However, this can be redundant when the cache is already valid.

With the cache-hit output, we can:

  • Avoid unnecessary executions of melos bs when the cache is valid.
  • Reduce build times and resource usage.
  • Enhance workflow efficiency.

Example usage

Here’s how we plan to use the cache-hit output:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Flutter
        uses: subosito/flutter-action@v2
        id: flutter-action
        with:
          channel: stable
          cache: true

      - name: Conditionally run melos bootstrap
        if: steps.flutter-action.outputs.CACHE-HIT == 'false'
        run: melos bs

      - name: Continue with build
        run: flutter build apk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant