Generating credentials and configuring it on your Github Repo #161
michael-dollosa
started this conversation in
General
Replies: 0 comments
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
Note: The Repo owner should be the one doing the steps below. Anyone who cloned the repo should not in any way push their master.key or credentials.yml.enc
To understand fully the issue, we must know how Github Actions works, and how was it setup in Rails. Below is a good place to start.
https://dev.to/abdellani/github-actions-to-run-rubocop-and-rspec-tests-on-rails-with-postgres-47i
Back to the issue, here is a sample snippet of the error.
There are 2 things that need to be considered:
Solving 1st issue
You need to generate your own master.key. This means that you need to also generate a new credentials.yml.enc.
This will generate master.key and a new credentials.yml.enc
Solving 2nd issue
If you have read how to configure github action in rails, you will come across the step that the rails project should have a .yml file for github workflows. In the project folder, it is exactly rspec.yml
On this file, you will notice at around the end, that it uses RAILS_MASTER_KEY. RAILS_MASTER_KEY is an env variable where you store your master.key.
However, in this case, it was setup to read the configuration on your github repo settings (${{ secrets.RAILS_MASTER_KEY }}
So next step is to setup your key in your own repo. Go to your repo and click Settings -> Secrets.
Click New Repository Secret. It is important to note that the variable should be exactly the env variable on your rspec.yml - which is RAILS_MASTER_KEY.
Run your tests again and it should be done 💯
Beta Was this translation helpful? Give feedback.
All reactions