Add something like `dokku git:sync --build-if-changes ...` flag
Description of feature
Ask
As is, dokku git:sync --build always rebuilds an app. It could be nice to have another flag which only builds when the remote repo has new changes. Like --build-if-changes or something. This is mostly a nice-to have but it could make sense to me.
Workarounds
There's definitely a way to set this up myself by running something like dokku git:sync &> out.txt && **check out.txt somehow** || dokku git:sync --build but it's a bit long-winded.
Context
I have a cron job at /etc/cron.d/kevsync
59 10 * * * dokku dokku git:sync --build blog https://github.com/kleutzinger/lektor-blog.git
It rebuilds my static site https://kevbot.xyz/blog each night based on what's on the github repo. This is working fine, but it rebuilds each night regardless of upstream changes or not.
https://dokku.com/docs/deployment/methods/git/#initializing-an-app-repository-from-a-remote-repository
the relevant source code to git:sync is here-ish i believe.
https://github.com/dokku/dokku/blob/a77c27d088b76d7255e3a37586a00a2b1815611f/plugins/git/internal-functions#L211-L219
The logic for this can be done as shown here.
Probably makes sense to exit 0 if there are no changes.
Closing as there is a pull request open.
As an aside, we have an official github action that can be used to autodeploy your github repositories.