-
-
Notifications
You must be signed in to change notification settings - Fork 25
Github Actions
Jeff Felchner edited this page Sep 2, 2021
·
1 revision
If you want to use Chamber with Github Actions, and run tests which relies on chamber secrets, how would you do this? Here is an example which demonstrates the problem:
class UsersControllerTest < ActionDispatch::IntegrationTest
test "some test" do
get user_url(@user)
end
end
class UsersController < ApplicationController
def show
puts Chamber.dig!(:smtp_email, :mailhost)
end
end
How can Github actions access this variable without Chamber's secrets key being known to Github?
The trick is to let Github know about your secret key. You can add it to your repository. In order to add it, you would go to your repository's setting page and add it like so:
Then, in your Github action, simply ensure that you set up the CHAMBER_KEY environment variable.:
# .github/workflows/
name: ci
on: [push, pull_request]
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
env:
CHAMBER_KEY: "${{ secrets.CHAMBER_KEY }}"
# the rest of your actions
Special thanks to @benkoshy for adding this page.
Copyright ©2023
- Release News
- Gem Comparison
- 12-Factor App Rebuttal
- Environment Variable Problems
- Installation
- Basics
- Defining Settings
- Accessing Settings
- Verifying Settings
- Namespaces
- Environment Variables
- Integrations
- Encryption
- Advanced Usage
- Command Line Reference