Use `repository_dispatch` to trigger rebuilt on ALTER TABLE
Just saw that you can use an API request to trigger a GitHub action, example: https://dev.to/rikurouvila/how-to-trigger-a-github-action-with-an-htt-request-545
So rather than a cron job, you could use an EVENT TRIGGER to kick off the GitHub action anytime a table is altered:
CREATE FUNCTION public.dispatch_github_action()
RETURNS event_trigger
LANGUAGE plpgsql
AS $$
BEGIN
PERFORM
net.http_post(
url:='https://api.github.com/repos/<username>/<repo>/dispatches',
body:='{"event_type": "world"}'::jsonb,
headers:='{"Content-type":"application/json","authorization":"Bearer <TOKEN>"}'::jsonb
);
END;
$$;
CREATE EVENT TRIGGER dispatch_github_action ON ddl_command_end
WHEN TAG IN ('ALTER TABLE')
EXECUTE FUNCTION public.dispatch_github_action();
Alternatively, you could also set up something like husky https://dev.to/devictoribero/how-to-use-husky-to-create-pre-commit-and-pre-push-hooks-4448 to run the type-gen locally before committing/pushing to GitHub.
Added some docs on the branch update-docs-for-event-trigger based on the comment above, however, I wasn't able to get the script working as intended successfully despite enabling pg net in the extensions.
Encountered the following error

If anyone else can get the DB trigger to work successfully, feel free to create a PR based off the branch above and add to the docs accordingly.