Skip to content

Commit

Permalink
feat: add .env for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dwinston committed Nov 2, 2021
1 parent 7631d21 commit f7d51e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ jobs:
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Make .env file
run: bash github_secrets_to_dotenv.sh "$secrets"
env:
secrets: ${{ toJson(secrets) }}
- name: Test with pytest
run: |
pytest
7 changes: 7 additions & 0 deletions github_secrets_to_dotenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
# Create .env file from GitHub secrets

json_secrets_str=$1
env_filename=".env"

jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]' <<< "$json_secrets_str" > "$env_filename"

0 comments on commit f7d51e2

Please sign in to comment.