Ruby Script step - Using Env variables and loading the content from a file

Hi,
I started to use this Ruby Script Step for a simple task requiring a Ruby gem. It is working but I cannot use the ENV variables in the current workflow and also I would like to load the content from a file like this:

      - ruby-script@2:
          run_if: |-
            {{enveq "PIPELINE_STATE" "test"}}
          inputs:
            - file_path: "$BITRISE_SOURCE_DIR/tooling/bitrise/scripts/hermes.rb"
            - script_run_dir: "$BITRISE_SOURCE_DIR"
            - gemfile_content: |-
                source 'https://rubygems.org'
                gem 'msteams_hermes'
          is_always_run: true

Do you have any idea how to manage this? Thanks.