Webhook to auto-modify HTML and trigger commit to repo

I am trying to come up with a way of modifying HTML of HUGO and then automatically building/commiting it to remote hit repo. The page already deploys itself every time there is a change commited to a branch, so this part is sorted.

However, I still need to figure out how can I build/commit upon a webhook that hits the repo and contains some information (one string I want to inject to HTML and one boolean).

Any ideas?