This Mountain Dev action automatically deletes the preview database associated with a pull request when the PR is closed. It's designed to clean up resources and prevent unnecessary database accumulation.
- Automatically deletes the preview database when a PR is closed
- Uses
dotenv-vaultfor secure handling of environment variables - Includes safety checks to prevent deletion of protected databases (dev, staging, prod)
- Dynamically generates database names based on branch names
The action uses the following environment variables:
DOTENV_ME: Required. The Dotenv VaultDOTENV_MEtoken for accessing encrypted environment variables.DATABASE_URL: Extracted from the CI environment. The base database URL used to generate the preview database name.
- The action includes a safety check to prevent deletion of databases with names ending in
_dev,_staging, or_prod. - It only attempts to delete databases that follow the naming convention of the preview databases.
If the action fails, check the following:
- Ensure
DOTENV_MEis correctly set in your Mountain Dev secrets. - Verify that the PostgreSQL client is installed and accessible in the Mountain Dev environment.
- Check that the
dotenv-vaultCLI tool is installed and functioning correctly. - Review the action logs for any specific error messages.
Contributions to improve the action are welcome. Please follow these steps:
- Fork the repository
- Create a new branch for your feature
- Commit your changes
- Push to the branch
- Create a new Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions, please file an issue in the project's issue tracker.