Supabase config push

Hello, is there a command that allows, from a GitHub Action, to check a supabase config push for errors in the file and stop the workflow if an error is detected? Currently, I have the ability to push my config.toml from a GitHub Action to the remote to update the database information linked to secrets from Vercel. However, if there is a formatting error in the file, I would like the GitHub Action to stop.
12 Replies
ihm40
ihm402mo ago
When you say formatting errors, do you mean checking if the syntax of the config.toml is accurate in which case something like this might help https://github.com/tamasfe/taplo
GitHub
GitHub - tamasfe/taplo: A TOML toolkit written in Rust
A TOML toolkit written in Rust. Contribute to tamasfe/taplo development by creating an account on GitHub.
ihm40
ihm402mo ago
I have this downloaded locally and can run taplo lint config.toml to check for any errors you can probably configure it in a github action some way but also could do a git pre commit hook
inder
inder2mo ago
If you do mean formatting errors, you can also use yq. Its preinstalled in github actions ubuntu & macos runners. And you can validate toml/yaml files with this cmd:
yq 'true' config.toml > /dev/null
yq 'true' config.toml > /dev/null
Quentin
QuentinOP2mo ago
Great, thank you! Yes, I was indeed referring to the file formatting. But I was also wondering: if the lint passes, is it still possible for an error to occur during the push, for example related to applying the file in Supabase Remote?
ihm40
ihm402mo ago
the only issues i have ever had with config.toml files are where i create an edge function locally, delete it but forget to update the config.toml so it still references edge functions that don't exist. I think if you have the github integration this would fail anyway before deployment and it won't mess up your remote
Quentin
QuentinOP2mo ago
I dont use edge function haha In my case, I’m running supabase config push directly in a GitHub Action, and I’d like the action to stop if applying the changes fails, so that the frontend and database migrations don’t run anyway.
ihm40
ihm402mo ago
i think should be able to just check that it passes after you run the command and if it falls over don't do the other steps. I'm more familiar with gitlab pipelines but the yaml files usually let you specify that step B should not run until step A successfully runs i assume github actions would have similar functionality Have you considered using branching functionality if you want to be more safe? Sounds like you're pushing straight to prod and branching would let you make sure everything is okay and then you can merge the pull request?
Quentin
QuentinOP2mo ago
Yes, it works exactly the same way: B only runs if A succeeds. My question was specifically: if the config.toml push fails or encounters an issue, does the command return an error? So far, I haven’t seen any errors, but I wanted to make sure to avoid any surprises. Regarding Supabase’s branching system, I’m not sure I fully understand it, and I’m not certain it’s useful for my case. When a PR (on Github) is merged from the develop branch to master, GitHub triggers an Action that: - runs all frontend tests, - performs database migrations in dry-run, - deploys the frontend to production via Vercel, - executes database migrations, - applies the config.toml changes, etc.
ihm40
ihm402mo ago
i think that it should fail but that is simply based on the fact that misconfigured config.toml have been a source of failure for me on using supabase brances and github action. I assume the config.toml changes would be applied before frantend/database migration is this list
Quentin
QuentinOP2mo ago
I managed to understand: in my GitHub Action, during the supabase link, it already parses my config.yml and throws an error if the formatting is incorrect. So, if I use Taplo before the supabase link command as a precaution, everything is fine! Once the tests and Vercel deployment succeed, I can run this command.
ihm40
ihm402mo ago
nice, sounds like a good setup
Quentin
QuentinOP2mo ago
Everything works perfectly with the GitHub Action in both pre-production and production! I'm sharing the GitHub Action for Production in case anyone is interested :)

Did you find this page helpful?