diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index dbf7e82..7aaa06a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -51,4 +51,4 @@ jobs: command: "compose up --dry-run --project-name github-action-test" - name: Teardown - run: defang config rm DEFANG_GH_ACTION_TEST_MESSAGE + run: defang config rm --project-name github-action-test DEFANG_GH_ACTION_TEST_MESSAGE diff --git a/action.yaml b/action.yaml index ecfb0ef..c653d23 100644 --- a/action.yaml +++ b/action.yaml @@ -77,6 +77,24 @@ runs: params+=("-f") params+=("$filename") done + empty=() + for source in $CONFIG_ENV_VARS; do + if [ -z "${!source}" ]; then + empty+=("$source") + fi + done + + # if there are any empty variables, print instructions on how to update + # the github environment variables + if [ ${#empty[@]} -gt 0 ]; then + echo "Some Defang config vars do not have values. To use Github Secrets, add" + echo "these variables to your environment secrets:" + for source in "${empty[@]}"; do + echo "- $source" + done + echo "Here is a link to your repository environments settings:" + echo "https://github.com/${GITHUB_REPOSITORY}/settings/environments" + fi for source in $CONFIG_ENV_VARS; do echo "Updating $source" echo defang config "${params[@]}" set -e $source