GitHub Actions Runner execute commands with sudo GitHub Actions
airtower-luna from GitHub community answered it here and it worked for me
Answer pasted below:
The command in your workflow file is not the same as the one in your sudoers file, sudo doesn’t know they are functionally equivalent. Use twentydb.service in the workflow, too.
Also, is the user your runner runs as in the sudo group? If not, that entry won’t apply to it. However, I’d suggest using a separate entry for the user rather than adding the runner to the sudo group.