Skip to content

Commit

Permalink
Rely on GITHUB_ACTIONS environment variable
Browse files Browse the repository at this point in the history
The Actions platform sets this environment variable automatically. The
documentation says:

> Always set to true when GitHub Actions is running the workflow. You
> can use this variable to differentiate when tests are being run locally
> or by GitHub Actions.

which sounds perfect for our use case.
  • Loading branch information
derekprior committed Apr 11, 2020
1 parent 32619a6 commit 7898354
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ jobs:
RAILS_VERSION: ${{ matrix.rails }}
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
CI: "true"

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

# CI-specific setup
if [ -n "$CI" ]; then
if [ -n "$GITHUB_ACTIONS" ]; then
bundle config path vendor/bundle
bundle config jobs 4
bundle config retry 3
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ development: &default
encoding: unicode
host: localhost
pool: 5
<% if ENV.fetch("CI", false) %>
<% if ENV.fetch("GITHUB_ACTIONS", false) %>
username: <%= ENV.fetch("POSTGRES_USER") %>
password: <%= ENV.fetch("POSTGRES_PASSWORD") %>
<% end %>
Expand Down

0 comments on commit 7898354

Please sign in to comment.