It's just that function calls can only appear in very limited places in the program (only inside `steps`), and to define a function, you have to create a Git repository.
FYI there is also `on: workflow_call` which you can use to define reusable jobs. You don't have to create a new repository for these
https://docs.github.com/en/actions/writing-workflows/workflo...