This line, which does fly launch, is failing before the “Detected a Rails app” message. If I run the same command locally, this is the output I get:
flyctl launch --no-deploy --copy-config --name frdm-pr-820-1 --region sea --org frdm --verbose
An existing fly.toml file was found for app frdm-production
Scanning source code
Detected a Rails app
Creating app in /home/leo/work/v2
We're about to launch your Rails app on Fly.io. Here's what you're getting:
# ...
However when that command is ran on GH Actions, this is the output:
+ flyctl launch --no-deploy --copy-config --name frdm-pr-820-1 --image --region sea --org frdm
[88](https://github.com/.../job/20283474997#step:4:89)An existing fly.toml file was found for app frdm-production
[89](https://github.com/.../job/20283474997#step:4:90)Scanning source code
[90](https://github.com/.../job/20283474997#step:4:91)Error: failure finding bundle executable: exec: "bundle": executable file not found in $PATH
So something is going on between “Scanning source code” and “Detected a Rails app”. flyctl launch blows up before reaching the latter.
So it doesn’t matter if I add gem install bundler or not in the steps of the action; the fly-pr-review-apps action uses a very slim Dockerfile with basically alpine + the fly.io install script and nothing else. Because that image doesn’t have bundler, fly launch will fail, rendering the rest of the script unusable. I’m using Rails but I suppose this affects all other frameworks.
Easiest workaround for this seems to be passing --dockerfile ./Dockerfile and -y to fly launch, which skips the framework detection thing. I see some people have similar forks already. I can open a PR for this later if needed.
Let me add to that: the functions that the Rails scanner uses bundler for don’t apply to the scenario of a PR review - this isn’t the first time the application was launched, so those steps can be skipped.
I’m exploring modifying the scanner to skip over those steps if bundler can’t be found rather than erroring out.