'Override vars in env via GitHub Actions script

I copy my .env.example file:

    - name: Copy .env
      run: php -r "file_exists('.env') || copy('.env.example', '.env');"

But I also want to have override vars in the .env. I have tried:

    - name: Copy .env
      run: php -r "file_exists('.env') || copy('.env.example', '.env');"
      env:
        DB_DATABASE: test_db
        DB_USER: root
        DB_PASSWORD: root

But the new vars I assign in the YAML file do not override vars in the .env - how can I override vars in my .env in the Actions script?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source