Search code examples
github-actionsfastlane

Fastlane passed parameters from CLI are trimmed


I am trying to pass the Pull request title as a parameter to the lane

I run this command for example fastlane android distribute release_notes:$PR_TITLE And I can see from the logs that the command is executed correctly with the complete title [16:37:52]: $ bundle exec fastlane android distribute release_notes:ref: copy the services module inside app module

but when I print the passed argument I found it trimmed

    desc "distribute new build for testers, set internal to true to pass it for internal testrs"
    lane :distribute do |options|
        print "\n"
        print "release_notes"

        print options[:release_notes]

which prints release_notes ref:, trimmed after the : and it even gets trimmed after newlines in a strange way


Solution

  • As you can see from your release_notes:string command, fastlane parses colons in a key/value format. So it will break if you pass in a string which includes a colon.

    A more common pattern is to read the release notes from the environment variable within your lane. So instead of using options at all just do something like

    notes = ENV['PR_TITLE']