subosito / flutter-action

Flutter environment for use in GitHub Actions. It works on Linux, Windows, and macOS.
MIT License
2.23k stars 199 forks source link

flutter-action overwrites setup-ruby configuration #220

Closed gintautassulskus closed 1 year ago

gintautassulskus commented 1 year ago

Issue

Flutter-action overwrites ruby configuration, configured using setup-ruby.

Example scenario

Consider the example workflow below. Note macos-12 and flutter action with block.

name: ios-workflow
env:
  FLUTTER_VERSION: "3.7.0"
on:
  workflow_dispatch:
jobs:
  ruby-first:
    runs-on: macos-12
    steps:
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.2.2'
          bundler-cache: true
      - run: ls -la $(which ruby)    
      - uses: subosito/flutter-action@v2
        with:
          flutter-version: ${{env.FLUTTER_VERSION}}
          channel: 'stable'
          cache: true
          cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' # optional, change this to force refresh cache
          cache-path: /Users/runner/hostedtoolcache/ # optional, change this to specify the cache path
      - run: ls -la $(which ruby)

Expected behaviour

Ruby path, configured by setup-ruby, remains the same throughout the example workflow execution:

/Users/runner/hostedtoolcache/Ruby/3.2.2/x64/bin/ruby

Actual behaviour

Setup-ruby sets the ruby path to:

/Users/runner/hostedtoolcache/Ruby/3.2.2/x64/bin/ruby

Flutter-action resets the path to system ruby:

/usr/bin/ruby
subosito commented 1 year ago

This line cache-path: /Users/runner/hostedtoolcache/ breaks the PATH resolution; please use the default one.

gintautassulskus commented 1 year ago

This line cache-path: /Users/runner/hostedtoolcache/ breaks the PATH resolution; please use the default one.

Isn't this parameter meant to be customisable?

subosito commented 1 year ago

Yes, but your given value breaks the PATH resolution, use proper value and you're good to go.

gintautassulskus commented 1 year ago

I have just noticed the obvious, thanks.