Deploy new PostgreSQL files from GitHub commits
Recipe ToolsMarketingDocument/FileSales EnablementDeveloper ToolDatabase
What it does
When a scheduled interval triggers, this automation compares the latest GitHub commit with the previous deployment. It executes any new SQL files in PostgreSQL and logs each deployment to a spreadsheet.
Who it's for
Engineering teams who need to automatically deploy SQL schema changes from GitHub without manual intervention.
How teams use this
Deploy schema changes automatically
New SQL files committed to GitHub are detected and executed in PostgreSQL without manual steps. The team merges code and the database updates on schedule every 5 minutes.
Track all deployments in a log
Every execution is recorded in Google Sheets with the commit ID and file list so the team can audit what ran and when. Nothing changes in the deployment logic.
Skip non-SQL files and removed files
Only SQL files that were added or modified are executed. Renamed or deleted files are filtered out so only valid schema changes run in PostgreSQL.
Extend to include migration validation
Add a condition before execution to validate that each SQL file meets naming or syntax requirements. Only files that pass the check are sent to PostgreSQL.
How it works
- Check every 5 minutes. This automation runs on a scheduled interval every 5 minutes to look for changes in the GitHub repository.
- Compare commits in GitHub. Get the most recent commit from the head branch and compare it with the last deployment commit stored in Google Sheets to identify which files changed.
- Execute new SQL files. For each file in the comparison that is a SQL file and was not removed or renamed, run it in PostgreSQL to apply the schema changes to the database.
- Log deployment to spreadsheet. Add a row to the Google Sheets job report with the commit ID, files executed, and deployment status so the team has an audit trail of all changes.