-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from SpicyPizza/fix-empty-envkey-backwards-inc…
…ompatability Added input to toggle failing on empty env key
- Loading branch information
Showing
4 changed files
with
186 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,172 +1,207 @@ | ||
name: Test action | ||
|
||
on: | ||
push: | ||
on: [ push ] | ||
|
||
jobs: | ||
test-general: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Make envfile | ||
uses: ./ | ||
with: | ||
envkey_DEBUG: false | ||
envkey_SOME_API_KEY: "123456abcdef" | ||
envkey_SECRET_KEY: ${{ secrets.SECRET_KEY }} | ||
some_other_variable: foobar | ||
file_name: .env | ||
|
||
- name: Verify envfile | ||
run: | | ||
TEST=$(cat <<-END | ||
DEBUG=false | ||
SECRET_KEY=password123 | ||
SOME_API_KEY=123456abcdef | ||
END | ||
) | ||
if [ "$TEST" != "$(cat .env)" ] | ||
then | ||
echo "ERR" | ||
fi | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Make envfile | ||
uses: ./ | ||
with: | ||
envkey_DEBUG: false | ||
envkey_SOME_API_KEY: "123456abcdef" | ||
envkey_SECRET_KEY: ${{ secrets.SECRET_KEY }} | ||
some_other_variable: foobar | ||
file_name: .env | ||
|
||
- name: Verify envfile | ||
run: | | ||
TEST=$(cat <<-END | ||
DEBUG=false | ||
SECRET_KEY=password123 | ||
SOME_API_KEY=123456abcdef | ||
END | ||
) | ||
if [ "$TEST" != "$(cat .env)" ] | ||
then | ||
echo "ERR" | ||
fi | ||
test-filename: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Make envfile | ||
uses: ./ | ||
with: | ||
envkey_DEBUG: false | ||
file_name: .other-file | ||
|
||
- name: Verify envfile | ||
run: | | ||
TEST=$(cat <<-END | ||
DEBUG=false | ||
END | ||
) | ||
if [ "$TEST" != "$(cat .other-file)" ] | ||
then | ||
echo "ERR" | ||
fi | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Make envfile | ||
uses: ./ | ||
with: | ||
envkey_DEBUG: false | ||
file_name: .other-file | ||
|
||
- name: Verify envfile | ||
run: | | ||
TEST=$(cat <<-END | ||
DEBUG=false | ||
END | ||
) | ||
if [ "$TEST" != "$(cat .other-file)" ] | ||
then | ||
echo "ERR" | ||
fi | ||
test-relative-path-above: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Make envfile | ||
uses: ./ | ||
with: | ||
envkey_DEBUG: false | ||
directory: ../ | ||
|
||
- name: Verify envfile | ||
run: | | ||
TEST=$(cat <<-END | ||
DEBUG=false | ||
END | ||
) | ||
if [ "$TEST" != "$(cat ../.env)" ] | ||
then | ||
echo "ERR" | ||
fi | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Make envfile | ||
uses: ./ | ||
with: | ||
envkey_DEBUG: false | ||
directory: ../ | ||
|
||
- name: Verify envfile | ||
run: | | ||
TEST=$(cat <<-END | ||
DEBUG=false | ||
END | ||
) | ||
if [ "$TEST" != "$(cat ../.env)" ] | ||
then | ||
echo "ERR" | ||
fi | ||
test-relative-path-subdirectory-1: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Create folder | ||
run: | | ||
mkdir -p subdir | ||
- name: Make envfile | ||
uses: ./ | ||
with: | ||
envkey_DEBUG: false | ||
directory: subdir | ||
|
||
- name: Verify envfile | ||
run: | | ||
TEST=$(cat <<-END | ||
DEBUG=false | ||
END | ||
) | ||
if [ "$TEST" != "$(cat subdir/.env)" ] | ||
then | ||
echo "ERR" | ||
fi | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Create folder | ||
run: | | ||
mkdir -p subdir | ||
- name: Make envfile | ||
uses: ./ | ||
with: | ||
envkey_DEBUG: false | ||
directory: subdir | ||
|
||
- name: Verify envfile | ||
run: | | ||
TEST=$(cat <<-END | ||
DEBUG=false | ||
END | ||
) | ||
if [ "$TEST" != "$(cat subdir/.env)" ] | ||
then | ||
echo "ERR" | ||
fi | ||
test-relative-path-subdirectory-2: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Create folder | ||
run: | | ||
mkdir -p subdir | ||
- name: Make envfile | ||
uses: ./ | ||
with: | ||
envkey_DEBUG: false | ||
directory: ./subdir | ||
|
||
- name: Verify envfile | ||
run: | | ||
TEST=$(cat <<-END | ||
DEBUG=false | ||
END | ||
) | ||
if [ "$TEST" != "$(cat subdir/.env)" ] | ||
then | ||
echo "ERR" | ||
fi | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Create folder | ||
run: | | ||
mkdir -p subdir | ||
- name: Make envfile | ||
uses: ./ | ||
with: | ||
envkey_DEBUG: false | ||
directory: ./subdir | ||
|
||
- name: Verify envfile | ||
run: | | ||
TEST=$(cat <<-END | ||
DEBUG=false | ||
END | ||
) | ||
if [ "$TEST" != "$(cat subdir/.env)" ] | ||
then | ||
echo "ERR" | ||
fi | ||
should-fail-test-absolute-path: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Create folder | ||
run: | | ||
mkdir -p subdir | ||
- name: Make envfile | ||
uses: ./ | ||
with: | ||
envkey_DEBUG: false | ||
directory: /home | ||
- name: Create folder | ||
run: | | ||
mkdir -p subdir | ||
- name: Make envfile | ||
uses: ./ | ||
with: | ||
envkey_DEBUG: false | ||
directory: /home | ||
|
||
should-fail-test-bad-secret: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Create folder | ||
run: | | ||
mkdir -p subdir | ||
- name: Make envfile | ||
uses: ./ | ||
with: | ||
fail_on_empty: true | ||
envkey_SECRET_KEY: ${{ secrets.NON_EXISTENT_SECRET }} | ||
|
||
# Test empty envkeys | ||
should-fail-test-empty-envkey: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Create folder | ||
run: | | ||
mkdir -p subdir | ||
- name: Create folder | ||
run: | | ||
mkdir -p subdir | ||
- name: Make envfile | ||
uses: ./ | ||
with: | ||
envkey_SECRET_KEY: ${{ secrets.NON_EXISTENT_SECRET }} | ||
- name: Make envfile | ||
uses: ./ | ||
with: | ||
envkey_SECRET_KEY: "" | ||
fail_on_empty: true | ||
|
||
test-empty-envkey-default-option: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Create folder | ||
run: | | ||
mkdir -p subdir | ||
- name: Make envfile | ||
uses: ./ | ||
with: | ||
envkey_SECRET_KEY: "" | ||
|
||
- name: Verify envfile | ||
run: | | ||
TEST=$(cat <<-END | ||
SECRET_KEY= | ||
END | ||
) | ||
if [ "$TEST" != "$(cat .env)" ] | ||
then | ||
echo "ERR" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
name: 'Create .env file' | ||
description: 'Github Action to create a .env file with Github Secrets' | ||
author: 'Forest Anderson' | ||
branding: | ||
icon: 'briefcase' | ||
color: 'gray-dark' | ||
inputs: | ||
file_name: | ||
description: 'The filename for the envfile' | ||
default: '.env' | ||
directory: | ||
description: 'The directory to put the envfile in' | ||
default: '' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
name: "Create .env file" | ||
description: "Github Action to create a .env file with Github Secrets" | ||
author: "Forest Anderson" | ||
branding: | ||
icon: "briefcase" | ||
color: "gray-dark" | ||
inputs: | ||
file_name: | ||
description: "The filename for the envfile" | ||
default: ".env" | ||
directory: | ||
description: "The directory to put the envfile in" | ||
default: "" | ||
fail_on_empty: | ||
description: "Fail if an env key is an empty string" | ||
default: "false" | ||
runs: | ||
using: "docker" | ||
image: "Dockerfile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters