Skip to content

Commit

Permalink
Create .env file in docker-unit-tests directory for proper sourcing
Browse files Browse the repository at this point in the history
- Add a step to create a .env file in $HOME/tooling/docker-unit-tests after cloning, ensuring the script finds required variables.
- The .env file includes default values and securely injects GH_AUTH_TOKEN from GitHub Secrets.
- This resolves the "filename argument required" error during sourcing.
  • Loading branch information
zackkatz committed Feb 17, 2025
1 parent 2791c99 commit 80b5c5a
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

- name: Create .env file if missing
run: |
if [ ! -f .env ]; then
echo "PLUGIN_DIR=$HOME" > .env
echo "WP_LATEST_TESTS_DIR=./wordpress-latest-tests-lib" >> .env
echo "PHPUNIT_DIR=./phpunit" >> .env
echo "GF_PLUGIN_DIR=./gravityforms" >> .env
echo "GH_AUTH_TOKEN=${{ secrets.GH_ACCESS_TOKEN }}" >> .env
fi
- name: Install Docker Compose
run: |
sudo apt-get update
Expand All @@ -40,6 +30,17 @@ jobs:
- name: Clone GV Tooling
run: gh repo clone GravityKit/Tooling $HOME/tooling

# Create .env file in docker-unit-tests directory so that the script finds it.
- name: Create .env file in docker-unit-tests if missing
run: |
if [ ! -f "$HOME/tooling/docker-unit-tests/.env" ]; then
echo "PLUGIN_DIR=$HOME" > "$HOME/tooling/docker-unit-tests/.env"
echo "WP_LATEST_TESTS_DIR=./wordpress-latest-tests-lib" >> "$HOME/tooling/docker-unit-tests/.env"
echo "PHPUNIT_DIR=./phpunit" >> "$HOME/tooling/docker-unit-tests/.env"
echo "GF_PLUGIN_DIR=./gravityforms" >> "$HOME/tooling/docker-unit-tests/.env"
echo "GH_AUTH_TOKEN=${{ secrets.GH_ACCESS_TOKEN }}" >> "$HOME/tooling/docker-unit-tests/.env"
fi
- name: Authenticate GitHub for Composer
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
Expand Down

0 comments on commit 80b5c5a

Please sign in to comment.