Git add / push on Pull Requests

Hey Guys,
i am working with Gitea and Gitea Actions and i want to do some code formating in my Pull Requests to ensure that code is always formated even if developers forgot to format.

I tried to simply commit and push but that doesn’t work as i get the error that i am not in a branch. I tried to checkout {{gitea.ref}} like in the example but that actually doesn’t change anything. is there maybe a gitea variable to checkout the original branch for example the pull request is on feature/test to automatically checkout this branch?

Or has someone a solution to this.

Okay found that checking out ${{gitea.head_ref}} does work for a pull Request.