yes, of course. Service account use is a good practice.
Granting a primitive role (editor, owner, or viewer) isn’t, because the granted permissions are too broad.
In addition, to generate a service account key file, is a security problem: It’s only a file, that you can copy, send by email, push to a git repository (…) and you can easily lost the control.
you also need to keep this file secret, and, as best practice, you need to rotate this secret key at least every 90 days.