Best practice on moving tap to another hosting

I started moving kde-mac/kde tap repo from GitHub to KDE Invent (GitLab). And I wanted to ask: is there some good practice or prior research on how to do this flawlessly? I plan to discontinue GitHub mirror and force users to use new repo or just to untap it.

As for same hosting it’s pretty easy, i.e. you just rename or transfer repo to another group and hosting sets all needed redirects. But what about moving to completely different hosting? Is there some caveat I may present when users do brew update or try to install some formula?

I recall recent mass movement from GitHub to GitLab and Bitbucket after Microsoft acquired GitHub, maybe other maintainers already tried to do something similar?

I’m not one of those developers, but I think lodging a caveat in all your old tap’s formulas might be the way to go, something like this:

def caveats
  <<~EOS
    These formulas have moved to a new home. To continue receiving the latest updates:
      brew tap my/new/tap/location
      brew untap my/old/tap/location
      brew update
  EOS
end

As long as your users brew update in a timely fashion, and you give sufficient notice before the old tap is decommissioned, the info they need to cut over to your tap’s new location would be staring them in the face on every brew info <my_package>.

Another (possibly better) way to go about it: Add code to your old formulas that fail the install with explanatory messages. Here’s a concrete example from a tap maintainer who wanted to transition branch names from master to main, which currently necessitates the same sort of gymnastics as your situation: https://github.com/Homebrew/brew/issues/7746#issuecomment-649582087

With that method, the caveat example I gave becomes:

ohai "We've Moved!"

opoo """These formulas have moved to a new home, because reasons.
This tap is now deprecated, and subject to removal without notice."""

odie """To continue receiving the latest updates:
      brew tap my/new/tap/location
      brew untap my/old/tap/location
      brew update"""

Thanks @gromgit. And also for previous answer, I actually applied it. Will going to unarchive my repo and add this new recommendation to it.