Smarty作为子模块

Is there a way I can add Smarty PHP's libs folder to my open source GitHub project and have it auto-update when Smarty updates?

Consider managing dependencies via Composer, then include Smarty via Packagist reference.

This way you can either refer to the latest dev version, or to a specific one - the latter approach advised, in order not to fall into breaking issues.

No, because the only reference you can register in your GitHub repo would be a submodule one.
(as in "Using someone else's repo as a Git Submodule on GitHub")

And a submodule is all about referencing a fixed commit, not "the latest".

You could work with subtree merging, but:

  • the update would be done locally
  • that would duplicate the data (between Smarty initial repo and your own repo), pushed to GitHub.

You can use this repo which is a Git mirror of Smarty. You really don't want external libraries to automatically update.

What if the update has a bug or some other change which breaks your code? How do you roll back? How do you even know where to roll back to if updates happen automatically?

I would strongly recommend you avoid automatic updates and instead update manually if you know you need new features or bug fixes in Smarty.