Missing Master Key Error Github Action with test.key stored as a secret

Viewed 17

I am going crazy with Rails Credentials! I have a Missing Master Key Error when launching my Github Action test.

I have

  1. generated credentials/test.key and credentials/test.yml.enc with rails credential:edit -e test command,

  2. stored the content of test.key in a GITHUB Actions Secret

  3. referenced it in my Github Action

    env:
      RAILS_ENV: test      
      RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
    

Still say "Missing Key"... I also have done the same in production (as before the master.key was stored on Github!!)

1 Answers

You could run the following to add the key under config before you start running the tests.

echo "$RAILS_MASTER_KEY" > config/master.key

Related