This fixes the workflow to work for pull requests in addition to pushes:
- Correctly determines the repository and branch
- For pull requests, if there are changes, fails with a message to make
the changes locally
- Extracts the commands to update generated files into a script